Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

transaction not taking place  RSS feed

 
Sachin Choudhari
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using stateless session bean with container managed trasaction and requiers as an transaction attribute. For testing purpose I am throwing an exception but data is not getting rollback.
It seems transaction is not managed properly by container. I am using Jrun 3.1 as app. server.
Thanks in advance.
 
benb
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the exception you throw is an application exception (i.e. not a system exception), the behaviour you describe is normal. The container should not rollback a transaction because of an application exception.
If you want to force a rollback in your session, you must mark the transaction for rollback invoking setRollbackOnly on the session context.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!