This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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. 1.TX_MANDATORY
2.TX_REQUIRED 3.TX_REQUIRES_NEW Answer given: 2,3. Why is not 1 a valid option.
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.