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

interceptor runs in the bean's transaction ?

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From chapter 12 of JSR 318, it does not say that interceptors run in the bean's method's transaction.

Should interceptors running in the same transaction as the bean?

From p. 336,
AroundInvoke methods can mark the transaction for rollback ... by calling EJBContext setRollbackOnly()...


But what happens if the bean is a BMT ? Calling EJBContext setRollbackOnly() from the interceptor in BMT does not make sense.
 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To answer my own question, if the bean is a BMT and if the interceptor calls EJBContext.setRollbackOnly, it will throw illeglStateException:


 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more thing I tried:





javax.ejb.EJBException
.....
Caused by: java.lang.IllegalStateException: Transaction is not active in the current thread.



I still get an error.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic