• 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

Transaction

 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic