Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transaction

 
Alibabra Sanjie
Ranch Hand
Posts: 147
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Container must throw the java.lang.IllegalStateException if the EJBContext.setRollbackOnly() method is invoked from a business method executing with the Supports, NotSupported, or Never (for MDB - ONLY with NotSupported) transaction attribute.

I don't why "...The Container must throw the java.lang.IllegalStateException..." If the method executed in a transaction context from the client, with the supports and NotSupported attributes, the container will throw IllegalStateException?
 
Joyce Lee
Ranch Hand
Posts: 1392
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the method executed in a transaction context from the client, with the supports and NotSupported attributes, the container will throw IllegalStateException?

Yes, you're right. It doesn't matter if the client is in a tranaction context while calling the bean's business methods, as long as the bean's business methods are set with Supports, NotSupported or Never attribute in DD, and the bean calls the Context.getRollbackOnly or Context.setRollbackOnly, the bean will receive illegalStateException thrown by the Container.
Note: Bean's business method with NotSupported attribute, will always be executed in unspecified transaction context.
Joyce
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The transaction attributes Supports, NotSupported and Never do not require a transaction. Therefore, it seems reasonable to me that the invocation of any EJBContext method such as setRollbackOnly() must be regarded as illegal when the method is marked with any of these attributes and will result in java.lang.IllegalStateException being thrown by the container.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic