• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Supports attribute ?

 
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
 
Ranch Hand
Posts: 211
  • 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
 
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
 
Popeye has his spinach. I have this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic