• 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

EJB 2 BMT

 
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, I encountered a strange situation where the container was calling setRollbackOnly() after a runtime exception.(Okay I know that doesn't sound so strange)BUTwhat's confusing me is that the BMT method was not called from and did not start any transactions....So what happened was the method threw a runtime exception and then the container called setRollbackOnly().That's all well and good but what does that mean??If no transaction was started then what is it rolling back?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


So what happened was the method threw a runtime exception and then the container called setRollbackOnly().That's all well and good but what does that mean??If no transaction was started then what is it rolling back?


That does sounds wierd. Its BMT, the bean is supposed to be managing the transaction so setRollbackOnly should not need to be called.
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes...Maybe it's something specific that WAS 6 does??Because I'm pretty sure if I call setRollbackOnly() when there is no transaction I will get an IllegalStateException...
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It will do, if you are using CMT. But you are not.
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So this is different from EJB 3.0?Here's an excerpt from EJB3.0 core specs:

13.3.3.1 getRollbackOnly and setRollbackOnly Methods
An enterprise bean with bean-managed transaction demarcation must not use the getRollbackOnly
and setRollbackOnly methods of the EJBContext interface.
An enterprise bean with bean-managed transaction demarcation has no need to use these methods,
because of the following reasons:
� An enterprise bean with bean-managed transaction demarcation can obtain the status of a
transaction by using the getStatus method of the javax.transaction.User-
Transaction interface.
� An enterprise bean with bean-managed transaction demarcation can rollback a transaction
using the rollback method of the javax.transaction.UserTransaction interface.

 
reply
    Bookmark Topic Watch Topic
  • New Topic