File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Transaction attributes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Transaction attributes" Watch "Transaction attributes" New topic

Transaction attributes

sonali rao
Ranch Hand

Joined: Nov 03, 2003
Posts: 64
I came across this question in a mock exam.
Which of the following EJB Transaction Attributes ensures that the method call always takes place in a transaction, either client started, or container started? Select 2 correct Choices.

Answer given: 2,3.
Why is not 1 a valid option.
Anselm Paulinus
Ranch Hand

Joined: Sep 05, 2003
Posts: 389
TX_REQUIRED and TX_REQUIRES_NEW will always run in a transaction. TX_REQUIRED will start a new transaction where non exists and TX_REQUIRES_NEW will always run in a new transaction irrespective of whether one exists or not but TX_MANDATORY will throw an exception if called without an existing transaction.
subject: Transaction attributes
jQuery in Action, 3rd edition