wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes About @AfterBegin definition on the study notes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "About @AfterBegin definition on the study notes" Watch "About @AfterBegin definition on the study notes" New topic
Author

About @AfterBegin definition on the study notes

Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 801
    
    1
Hi, on Frit's notes p. 24, session 2.3.7.1 , it says

The afterBegin notification signals a session bean instance that a new transaction has begun. The container invokes this method before the first business method within a transaction (which is not necessarily at the beginning of the transaction.)


Does "Which is not necessarily at the beginning of the transaction" refers to the first business method?
Does it mean the first business method within a transaction is not always at the beginning of the transaction?
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1717
    
  25

Does it mean the first business method within a transaction is not always at the beginning of the transaction?

Yes, the answer comes from the specs (4.3.7):
The afterBegin notification is invoked with the transaction context. The instance may do any database work it requires within the scope of the transaction.
Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 801
    
    1
I also think that an interceptor method can be the first method in a transaction before the first business method is called within this transaction.
That may be why JSR 318 says the first business method may not be necessarily at the beginning of a transaction.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About @AfterBegin definition on the study notes