How Transaction Rollback within multiple EJB

Hello,
I am new to EJB, i would like to know how does the transaction could be rollback..? For instances in our project, the session
bean act as the manager for control the transaction in action class..
For Example;
Table A, Table B, Table C, Table D
In this case, each table are acts as one EJB, and for sure there was 4 session bean, session bean A(AManager), session bean B(BManager), session bean C(CManager), session bean D(DManager)... and EJB A, EJB B, EJB C, EJB D....
In the action class
There was one transaction involve 4 table, for example;
AManager manager = (AManager) EJBService.getFactory().lookUpManager("AManager",AManagerHome.class);
follow in.. B,C and D also same calling the Manager(session bean ) class...
try
{AManager.add("something);}
Catch(Exception e){}
try
{BManager.add("something);}
Catch(Exception e){}
try
{CManager.add("something);}
Catch(Exception e){}
try
{DManager.add("something);}
Catch(Exception e){}
If there was error in transaction CManager, how does all the transaction (AManager,BManager)could be rollback?
Any suggession? any good website? Thanks for all your help guideness...
Feel very appreciate for any help...

Hi,
From your description I can model your problem like this:
You have one method executing one particular task involving four session EJBs like this:
public void performTask(){
try{
AManager.add("something);
}catch(Exception e){}
try{
BManager.add("something);
Catch(Exception e){}
try{
CManager.add("something);
Catch(Exception e){}
try{
DManager.add("something);
Catch(Exception e){}
Now I will introduce another concept: Session Facade. And our performTask() method belongs to Session Facade. Session Facade is nothing but another session bean which the client talk to.
Now your problem is:
"CManager.add() creates some problems, then want to rollback the whole transaction-- specifically you want to rollback whatever done through AManager.add() and BManager.add() methods."
Solution Steps:
============
1. Set the transaction-attribute of performTask() method to
RequiresNew. It means whenever client(any java application or
other EJB) invokes the performTask() method, this method starts
execution in a new transaction context.
2. Now set the transaction attribute of Session A, Session B, Session
C, Session D, EJB A, EJB B, EJB C, and EJB D in such a way that
transaction context of performTask() method should be propagated
to these Enterprise beans. It means when you are calling
AManager.add() method from performTask() method, the
AManager.add() method should be executed under the same
transaction context as of parformTask(). Also true for other manager.
3. Throw System Exception when you will get some error inside
CManager.add() method. This will automatically rollback the
transaction. You don't need to worry.
Does it solve your problem? For further information you should go through the following book:
Enterprise Java Beans, Orielly Publication

Similar Messages

  • WebLogic Debugging thru Multiple EjBs using VCafe 3.1

    Here is my problem:
    We are trying to use use WebLogic 4.5.1 and Visual Cafe 3.1 and debug
    with break points within multiple EjBs. However, this is not going so well.
    My first question is this, is what we are trying to do even possible with
    the versions we are using. From all I have read I gather now it is possible
    to debug using the aforementioned versions of WL and VC with special
    handling. Or is it necessary to use different versions. The problem with
    that would be that there is no Enterprise relase of Cafe past 3.1 yet.
    Further we want to use Java 1.2 and that means we have to use WL 4.5.1 (so
    4.0.3 is not an option although it works well with Debugging with VC 3.1)
    Any help or direction would really be appreciated. Thank you.

    Mark,
    Please post this in the weblogic.developer.interest.general newsgroup
    Thanks
    Raj Alagumalai
    WebLogic Workshop Support
    "Mark Hartnett" <[email protected]> wrote in message
    news:3f57a4a3$[email protected]..
    >
    I am having a problem debugging using Eclipse 2.1 and the weblogic serverplugin
    provided by this site.
    If I start the server and run the application everything works fine.
    If I put a breakpoint into my code and then run the application I do notsee the
    application breaking at all. I am in debug view of Eclipse. The browserjust
    hangs and will not respond. I can take the breakpoint off and refresh thebrowser
    and it works fine again.
    Do I need to have anything special in a configuration file for weblogic toenable
    debugging ?
    Do I need to start the JVM with any special parms. I am currently usingthe following
    startup options. I have tried a number of configurations on the startupoptions
    and nothing works.
    -hotspon
    -ms64m
    -mx256m
    -Xdebug
    -Djava.compiler=none
    -Xnoagent
    -Dweblogic.ProductionModeEnabled=false
    I am using Weblogic 6.1 and JDK 1.3.1_09
    Thanks in advance for any help...

  • How to commit/rollback a transaction encompasing multiple EJBs

    I have 2 Stateless Session Beans 'RulesManager' and 'BankManager'. Each EJB method in them gets a connection, perform the task, close the connection and return the results.
    Now in RulesManager I have an EJB method processRules(). And in BankManager I have an EJB method updateTransactions().
    I have a requirement that means I first have to call BankManager's updateTransactions() method; if successful then call RulesManager's processRules() method. IF its successfull as well then commit else rollback.
    I dont know how to do this. Can anybody help me in this regard?
    Thanks

    Thanks kdgregory. This is how the things work out in our application.
    I have a class BankDelegate which has each public method in BankManager SSB without the throws clause. Inside each method I get remote interface of BankManager SSB and then calls the corresponding EJB method.
    Similarly I have a RulesDelegate class which has each public method in RulesManager SSB without the throws clause. Inside each method I get remote interface of RulesManager SSB and then calls the corresponding EJB method.
    User press Update button on JSP which submits the form to another JSP. That JSP creates an instance of BankDelegate and call its updateTransactions() method.
    Each EJB method is using container managed transactions. Inside each EJB method, if anything failed then i issued a rollback using this._sessionContext.setRollbackOnly();
    I am using MS SQL Server 2000.
    Thanks

  • Cmp 2.0 how to rollback all related transactions

    Hi,
    As to rollback in cmp 2.0, I'm wondering:
    1. how to make a rollback (is call rollbackOnly the only way)?
    2. how to define within same transactions when an exception caught, rollback all other trans?
    3. modify in descriptor or in code, how? what's diff
    Thanks
    John

    Hi,
    As to rollback in cmp 2.0, I'm wondering:
    1. how to make a rollback (is call rollbackOnly the
    only way)?Yes. Entity beans can only have Container-managed transactions,
    so the only way to tell the container to mark the tx as rollback only
    is to call EntityContext.setRollbackOnly().
    >
    2. how to define within same transactions when an
    exception caught, rollback all other trans?There is no such behavior in EJB or J2EE. There is
    no special relationship/association like this
    between J2EE transactions. E.g., there are no
    nested transactions in J2EE. All transactions are
    independent and peers of one another.
    >
    3. modify in descriptor or in code, how? what's diff
    Thanks
    John

  • How can I create multiple versions of a video within the same project?

    OK...this is a probably a very basic question but I'm not sure how to word it clearly.
    How can I create multiple versions of a video within the same project? What I mean is that I have a bout 50 minutes of video and I want to make two DVDs using different clips from this original 50 minutes of footage. It would be a real pain to have to re-import the video AGAIN for the second DVD. I suppose I could drop anything I don't want to burn to DVD back into the clips pane but that would wipe out all my transitions wouldn't it? I want to save each project in their “raw” form so I can burn additional DVDs later otherwise I would just do them one at a time and not care about one of them being destroyed.
    Wow...that was a mess. Does anyone understand what the heck I’m asking? I hope so.

    How can I create multiple versions of a video within the same project?
    You can't. You make separate projects using the same or different clips, segments, transitions, titles, etc. You can even duplicate the first project and then modify/make the desired changes in the duplicated project. Each project can then be burned as a different DVD or as different titles on the same DVD if there is enough room.

  • How to use multiple ejb-jar.xml files

    Hello -
    If the project you work on has a lot of beans that you need to configure them in one ejb-jar.xml file. Then ejb-jar.xml file will be getting bigger and bigger. I am wondering if there is any way to divide the ejb-jar.xml file into multiple sub ejb-jar.xml files and then combin them together when deploy it. Same question question for the vendor ejb-jar.xml like weblogic-ejb-jar.xml.
    Thanks!
    Ben

    HI Ben,
    No, there is no notion of combining ejb-jar.xmls at deployment time in Java EE. There is no
    set limit on the number of ejb components within an ejb-jar module either.
    --ken                                                                                                                                                                                                                                                                                                                                                                                       

  • How to write multiple ejb-jar.xml file in an ejb module

    i am developing an ejb project. I hav a number of entity beans and session beans and their mapping in ejb-jar.xml. As the number of beans increases the entry of beans and mapping is also increasing. So i want to ask u that is there any mechanism so that i can divide the ejb-jar.xml file so that it will be easy to maintain it.

    ejb-jar is the smallest composable unit for related EJB components. Your best bet is to create multiple ejb-jars and package them within the same enterprise application (.ear).

  • How can i locate the properties files within a ejb container?

    when i develop servlet+javabean structure application,in order to imploement decoupling,i
    would like to write the config information in the properties files(key-value pair),in
    servlet,i use "getResourceAsStream(String relativePath)" method to retrieve the
    configuration information from the properties files(i even write the SQL clause
    in the files),it alwsys works well.
    now,i want to implement such function within the ejb container,that is to read
    a properties file from session bean,but i don't know how can i locate the file
    within the ejb container by using relative path,i wonder if there is the same
    method within ejb container as "getResourceAsStream(.......)" method within servlet
    container?
    thanks for any helps!
    the code snippet is appreciated!

    In general, you should look at using environment entries (variables) in the
    deployment descriptors (both the war and EJB jar rather than properties
    files for configuring J2EE applications. The reasons for this are many:
    1. This is the official way to do it according to the spec. Properties
    files are the J2SE way of doing things
    2. As you note, that it's not obvious how you would (legally) read a
    properties file inside an EJB.
    3. It's consistent between the web and EJB part of your code
    4. the weblogic console and tools have good capabilities to edit these
    fields.
    Kent
    "zhebincong" <[email protected]> wrote in message
    news:[email protected]..
    >
    when i develop servlet+javabean structure application,in order toimploement decoupling,i
    would like to write the config information in the propertiesfiles(key-value pair),in
    servlet,i use "getResourceAsStream(String relativePath)" method toretrieve the
    configuration information from the properties files(i even write the SQLclause
    in the files),it alwsys works well.
    now,i want to implement such function within the ejb container,that is toread
    a properties file from session bean,but i don't know how can i locate thefile
    within the ejb container by using relative path,i wonder if there is thesame
    method within ejb container as "getResourceAsStream(.......)" methodwithin servlet
    container?
    thanks for any helps!
    the code snippet is appreciated!

  • How do I created multiple folders within folders in "Photo"

    How do I created multiple folders within folders (subfolders) in "Photo".  It happens in the first level when I use the Albums folder, but thereafter it doesn't allow me to create another folder within the folder.  I can also not drag a folder into another, after the first level of folders.  Please help.

    Yes you can.  Click once on the top folder and use the File ➙ Create Folder menu option.  A new folder will be created inside the selected folder:

  • How to rollback previous transaction in a series of Adapters in BPEL

    in Bpel process we integrate 3 db adapters,
    2 adapters are successfully complted,3rd adpter failed.
    inthis situation how we rollback the 3 adapter transaction with out using of compensate handling

    hey,i have made the code plz chk it and do rep soon as ma project sbmission date is very near =((
    i am snaping an image from the web cam then comparing it with the red colored jpg image made in paint.
    the jpg image is converted  to give input image to imaq match vi.but after the comparison it gives the same output.
    on the front pannel the snapped image is displayed,the red colored image that is converted in to its respective pixels is displayed and the image that is obtained after cheking the image in the draw fails vi...the pic converted to pixels is all the time displayed.and the pass/fail icon always denotes one pass led on..plz chk the code =((.
    also can u provide me some guide line for using thr hough transform for the red color detection in lab view..i dont have to import the matlab code..i have to purely make it using the lb view libraries.
    also one more request pl rep me regularly as i really need your golden piece of advice for ma success.
    thnx
    Attachments:
    picture to image(BY ME).vi ‏102 KB
    untitled.JPG ‏3 KB

  • Does a single transaction, spreeds accross multiple rollback segments?

    Hi,
    Does a single transaction, spreeds accross multiple rollback segments?
    What if , there is not enough space in the allocated rollback segment?
    Thanks
    Naveen.

    With the additional note/ caveat that, assuming you're using a moderately recent version of Oracle and using automatic UNDO management, which you really, really ought to be doing, Oracle is constantly adding, removing, and expanding the rollback segments, making it all but impossible for a rollback segment to be too small unless it (along with all the other active redo segments) exceed the size of your UNDO tablespace.
    Justin

  • How can we use multiple transactions by using bdc_insert.

    HI
    How can we use multiple transactions by using bdc_insert.

    Hi,
    In between the Open and Close we have to use the BDC_INSERT for the Tcodes you have to do.
    BDC_OPEN_GROUP
    BSD_INSERT
    TCODE = tcode1
    BDC_INSERT
    TCODE = tcode 2
    BDC_CLOSE_GROUP
    check the SDN for more on this.
    Regards
    Lekha

  • How do you add a water mark to multiple images within multiple files?

    I am having real trouble in trying to add a water mark to multiple images (mixture of jpegs and tiffs) within multiple file.
    I have used the Batch processing tool, but this hasn't worked or has been inconvenient, asking me to resave each individual file.
    If anyone can help or suggest another way of doing this, that would be great!
    Thanks
    Becca

    Are you using Russell Brown's script for placing watermarks?  Also you mentioned, "Within multiple file."  Did you mean multiple folders?  The batch processor has a check box for applying process to multiple folders.  What itsn't working - exactly?

  • How make a transaction rollback?

    Hello to everybody...
              hoew can I call a server transaction rollback ( Session Bean ,CMT ) by the client?

    Hi ,
    Call transaction SICF and Navigate to "webgui" service; then right-click and select option "Activate".transaction will work definitely.
    This should enable the WebGui functionality in your WAS.
    ITS WEBGUI in ECC6.0
    for more information , check below thread
    MY FEW QUESTIONS
    SSO with ITS & Webenabling WEBGui
    Koti Reddy

  • Transaction Isolation Level for EJB methods

    L.S.
    I just found out the in OC4J one can not set the transaction isolation level on ejb methods. Moreover one needs to revert to bean managed transaction (manual coding of the ALL transaction logic) to set the isolation level.
    On entity beans one can only set the isolation level for the whole bean (not on individual methods), and in session beans there is no way at all to set the isolation level.
    This is on shear contract to all other application servers I used before (there one can declaratively set the isolation level for a ejb method, both in session and in entitybean deployment descriptors)
    Is it foreseen in a future release to include such a valuable feature will be provided by oc4j?
    Note that I was VERY surprised that OC4J could not handle this (I checked the j2ee spec, but admittedly the spec is a little vague about this support and makes it vendor dependent. the j2ee spec does not mandate this, except for CMP entity beans, but includes some suggestions on this ability. But most other application servers implemented the ability)
    Regadrs,
    Erik

    Hello Erik --
    I think we met in Perth recently?
    Anyway, your information is correct.
    We can set the transaction isolation level for each entity bean, at the bean level. We don't have for the specification of method level isolation settings -- I'd be interested to hear how you would like/do use this. What behaviour do you expect to see when a transaction is started that spans multiple methods on a bean with different declared isolation levels.
    For session beans, we do not currently have the ability to declaratively specify the isolation level to use for the bean. I know this is not in the forthcoming 904 release, and will to check what is beyond that.
    As you point out, this can be done programatically using the Connection.setIsolationLevel() method on any connections you are using from within the session bean.
    I'd would like to log an enhancement request for you for this functionality. Can you send me an email at [email protected] and we'll take it offline.
    -steve-

Maybe you are looking for

  • ANN: XDK for Java/PLSQL 9.2.0.1 PRODUCTION

    Today the 9.2.0.1 Production versions of the Oracle XDK for Java and PL/SQL were posted for download here on OTN. Visit the following links and click on the "Software" link in the left margin to download. [list] [*]XDK for Java [*]XDK for PLSQL [list

  • I am looking to buy this Imac tru Craiglist..part no. Z0MX1LL/A

    But can't find any info on this part number in apple? Why? Is it a counterfeit? The seller sent me a photo of the box with family ID:Z0MX Any ideas? Thanks

  • Cash Sales Cancellation

    Dear all, SAP supplies the standard Billing Document Type BV for Cash Sales. In the definition of this Billing Type, we can see S1 as the Standard Billing Type for Cancellation of Billing Sales. (S1 is the Cancellation type of Standard Billing Docume

  • Problems while processing maintenance service orders - external(PM)

    Hi........... i am Praveen, fresher to SAP R/3 - PM. I am facing some problems while processing maintenance orders - external service.( IDES ) I used control key PM 03 for external servicing. as per my knowledge it should create Purchase requisition

  • Fix text scaling on Youtube?

    Hi Firefox Support! I have a 3k monitor on my Laptop and Youtube has really small text on its UI. This doesn't happen to me on any other browsers like Chrome and IE. Is there a way to fix it or do I wait for an update? Thanks! I have a sample photo b