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

When CMT bean commit?

 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand that commit/rollback of CMT bean is called by container. I think CMT bean call rollback() when system exception occur or setRollbackOnly() was called, but when CMT bean call commit()?
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A CMT bean must never call the commit or rollback methods, it is the container which ends transactions.
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Roger Chung-Wee:
A CMT bean must never call the commit or rollback methods, it is the container which ends transactions.

I understand bean never call commit/rollback, but my question is when the container commit transaction.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As mandated by the EJB spec, a stateless session bean and a message-driven bean must commit a transaction before a business method returns.
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.

Do you have information about CMT stateful and CMT entity bean?
When the container commit transactions of CMT stateful and CMT entity bean?
 
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!