Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

beforeCompletion() always gets called ?

 
Timothy Toe
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
About CMT SFSB,

Doesn�t beforeCompletion() always gets called, regardless of whether the transaction is committed or rolledback ?

If this it always gets called, then why figure 5 of the Spec (and Crettaz�s Bean LC cheat sheet) shows 2 different paths from �method ready in TX� to �method ready� with one not calling beforeCompletion() ?

Is my understanding wrong ?

Any clarification is much appreciated.
 
X. Li
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
beforeCompletion() will not get called if a system exception is thrown from a business method in which a transaction is excuted.
 
Timothy Toe
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[beforeCompletion() will not get called if a system exception is thrown from a business method in which a transaction is excuted.] - I know this. What I meant was it will always be called assuming there is no System Exception. It will always be called if the transaction commits or rolledback.

Is my understanding correct ?

If it is, then why are the diagrams are drawn that way ?

Thanks.
 
Timothy Toe
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone has an answer to this ?
I did not get an answer in time for my exam. Fortunately I passed.
But I still have a lot to learn.
Like knowing the answer to this one.
 
Bart Laeremans
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The J2EE API seems to be very clear on this.

Interface SessionSynchronization.
***
The beforeCompletion method notifies a session Bean instance that a transaction is about to be committed.
***

So I think the beforeCompletion-method will not be called
when the transaction is set to Rollback. All the resources I've
found up till now also point to this answer.

Greetings
 
sandeep vaid
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bart Laeremans,

I think u r right and that is correct answer to it. If any case the rollback is made that dose not mean how, But if it is there for transaction beforeCompletion() will not be called.

Thanks!!
Sandeep Vaid
[ January 04, 2005: Message edited by: sandeep vaid ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic