• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

beforeCompletion() always gets called ?

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic