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

CMT Transaction

 
Alibabra Sanjie
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In FHEJB p509,
CMT transaction cannot stay open across multiple method invoation from a stateful session client (BMT transaction can).

Don't quite understand the above statement. Someone can explain?
 
Anselm Paulinus
Ranch Hand
Posts: 390
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simple; CMT can not be demarcated by the bean developer. In CMT a method specified in a transaction attribute is wholly involved in the trnsaction but in BMT the programmer can demarcate a transaction - he gets the transaction with a command such as ut = context.getUserTransaction() the transaction starts when he issues the command ut.begin(). He could decide not to commit or rollback the transaction in the same method, rather he does that in a different method. Now the down side is one can not say for sure which of the methods is going to be called first.
 
Alibabra Sanjie
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anselm Paulinus, your answer focus on BMT, but my question is mainly about CMT - the main sentence.
 
Dale Seng
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The client can call a method (on a CMT bean), and it might start a transaction. The bean might even call other methods that start other transactions (but no nested transactions, of course). In the end, when that original method from the CMT bean ends, there must be no transactions open. The container manages that. Think about your DD.... you had to tell it to use CMT for that bean. You also had to tell it how you wanted it to handle transactions (Required, Not Supported, etc). There's nothing in the DD to say "leave this one open at the end of the method", right?
--Dale--
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic