Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

CMT Transaction

 
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?
 
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.
 
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--
 
Too many men are afraid of being fools - Henry Ford. Foolish tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic