• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Beans CMT BMT

 
AR Shah
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
B.Sathish
Ranch Hand
Posts: 372
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks - that makes perfect sense!!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic