Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFEJB-497 Page- 4th qs

 
vijay Mamilla
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of the six transaction attibutes, three of them can be dangerous, with one on particular being EXTREMELY risky.Keeping in mind that Bean provider is not the one who specifies the attributs for the bean's methods, which of the six is potentially the most dangerous?

As per online ans:- Mandatory and NotSupported are dangerous, because they throw Exception.

Is NotSupported throw exception? Is this Ans is correct?
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The transaction attributes do not throw exception by themselves. However, the container will throw an exception if it detects some unconsistent behavior. For instance, the container will throw the java.lang.IllegalStateException if either getRollbackOnly() or setRollbackOnly() are invoked from a business method executing with the Supports, NotSupported or Never transaction attributes (17.6.2.8 + 17.6.2.9). Thus, it is possible that an exception be thrown when the NotSupported attribute is specified.
 
vijay Mamilla
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Valentin
 
Ana Nava
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Valentin Crettaz:
For instance, the container will throw the java.lang.IllegalStateException if either getRollbackOnly() or setRollbackOnly() are invoked from a business method executing with the Supports, NotSupported or Never transaction attributes (17.6.2.8 + 17.6.2.9). Thus, it is possible that an exception be thrown when the NotSupported attribute is specified.


I understand that a transaction with "NotSupported" attribute can throw exception and hence can be dangerous. But I don't understand how "NotSupported" is more dangerous than "Never". In "Never" too there is possibility of having methods calls to get/setRollbackOnly() that cause an exception. Also in "Never" an Exception can be thrown if called from a transaction which is not the case in "NotSupported" as it just suspends the transaction. :roll:
[ May 17, 2005: Message edited by: ana ]
 
vijay Mamilla
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic