Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

spanning txns across multiple business methods

 
Sankar Subbiramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to HFEJB, page 301 (point 5):
Bean rums multiple business methods in the same transaction


Question: Since Entity beans use CMT, and in CMT, a txn is committed/rolledback after each method call, how is it possible to span transactions across mutiple business methods ?
 
vikas prasad
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sankar,
may be if you read page 356 it might clear your doubt.
see you can call a method within a method. say there are 3 methods, A ,B and C with CMP. so if method A which is running in a transaction 1 will call method B and C both. Then both the methods run in the same transaction 1. ok.
for more detail in Transaction please read chapter 9 EJB Transaction.
this might definitely help you.
cheers
Vikas Prasad
SCJP 1.4 SCWCD 1.4 SCBCD 1.3
 
Sankar Subbiramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I meant: "spanning txns across multiple client calls".
This to do with the different commit options supported by EJB spec.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For a stateful session bean, it's possible to start a transaction in one method but end it in another method. This is almost never the right thing to do even though it is allowed by the EJB spec.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!