• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

interceptor runs in the bean's transaction ?

 
Bartender
Posts: 2419
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 2419
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 2419
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic