• 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

Doubt in BMT

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...
UserTransaction ut = validContext.getUserTransaction();
ut.begin();
......
ut.setRollbackOnly();
.......
ut.commit();


Is it correct to invoke the setRollBackOnly method in a BMT. What will happen when this method is invoked?
 
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This works. UserTransaction can invoke setRollbackOnly method. But this method should be of UserTransaction rather than EJBContext.

I tried this, javax.persistence.TransactionRequiredException: EntityManager must be access within a transaction & on the client it said
BMT stateful bean 'Process' did not complete user transaction properly status=STATUS_MARKED_ROLLBACK.

But why did it give such error on the server. Should'nt it have given a better exception like, EJBTransactionRolledbackException .Exception etc
 
Nikhil Jain
Ranch Hand
Posts: 393
 
Nikhil Jain
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ejbContext.setRollbackOnly();

In CMT, this method causes TransactionRequiredException. But it should be transactionRolledBackexception. This error is generated when server tries to commit.

Any Idea?
 
It is difficult to free fools from the chains they revere - Voltaire. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic