• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Session Beans CMT BMT

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everyone,

just a quick question. On HFEJB pg 196 it tells us that:

(for STATEFUL Session Beans)

You CAN'T:
- force a trans to rollback (CMT beans)
- find out if trans already set to rollback (CMT beans)

But you CAN:
- get a trans ref and call meths on it (BMT beans)

I'm just wondering why you can access the BMT transaction but not the CMT transaction.

Many thanks
AR Shah - SCJP - SCWCD
 
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For a session bean, only the methods in the component interface are transactional, you need to mark them with a transaction attribute if you are using CMT. The home interface methods like create are non-transactional. Hence the container would run them in an Unspecified Transaction Context. The rule is that if a method runs in an Unspecified Transaction Context, then you cannot call context.setRollbackOnly() and context.getRollbackOnly() i.e. ask the container to rollback the transaction or check to see if it is rolled back. Doing so will throw an IllegalStateException. But if you are using BMT, you are free to get the UserTransaction reference and start your own transaction. This will be clearer after you read the transactions chapter.
 
AR Shah
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks - that makes perfect sense!!
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic