• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Supports attribute ?

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
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