• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Supports attribute ?

 
Deep Chand
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MZ Study notes and most probably HF book (not remember which page exactly) say that Container must throw IllegalStateException if getRollbackOnly() is invoked from a business method executing with Supports, NotSupported, Never attributes. I understand why this behavior with NotSupported and Never attributes but then why with Supports? With Supports, it is possible that a business method is invoked with a trans context because the trans context is passed on with Supports. Am I correct? Please reply.

Thanks
Deep
 
Keerthi P
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With Supports, it is also possible that the method is invoked in an unspecified transaction context. Assuming that the method calls getRollbackOnly() and that it is invoked in unspecified transaction, then its a problem.
 
Deep Chand
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agreed that if method with Supports attribute is called with unspecified trans context then container will throw IllegalStateException. But what if the method is invoked with a trans context, then will it still throw the same exception (at least that's what I can infer from the MZ Study Guide)

Thanks
Deep
 
Stefan Guilhen
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my opinion the container will only throw the IllegalStateException when the getRollbackOnly() or setRollbackOnly() are called without a meaningful transaction context. At least this is what the spec says. This means that if you are using Supports attribute and the method is running in a meaningful transaction context everything should be ok because the Tx context exists and the container can perform the get/setRollbackOnly() methods. Otherwise, the container will throw an IllegalStateException.

Regards,
Stefan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic