Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

When CMT bean commit?  RSS feed

 
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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!