nerdexam
Oracle

1Z0-895 · Question #13

FooBean and BarBean are both EJB 3.x stateless session beans with bean-managed transaction demarcation. The business method foo in FooBean starts a UserTransaction and invokes the business method…

The correct answer is D. FooBean.foo method receives javax.transaction.TransactionRolledbackException. The transaction will roll back. *In bean-managed transaction demarcation, the code in the session or message-driven bean explicitly marks the boundaries of the transaction. Although beans with container-managed transactions require less coding, they have one limitation: When a…

Server Installation and Configuration

Question

FooBean and BarBean are both EJB 3.x stateless session beans with bean-managed transaction demarcation. The business method foo in FooBean starts a UserTransaction and invokes the business method bar in BrBean. Given: What is the expected result of this method invocation assuming control reaches Line 12?

Options

  • AFooBean.foo method receives MyAppException.
  • BThe container discards the BarBean bean instance.
  • CFooBean.foo method receives a javax.ejb.EJBException that wraps MyAppException.
  • DFooBean.foo method receives javax.transaction.TransactionRolledbackException.

How the community answered

(61 responses)
  • A
    5% (3)
  • B
    10% (6)
  • C
    2% (1)
  • D
    84% (51)

Explanation

The transaction will roll back. *In bean-managed transaction demarcation, the code in the session or message-driven bean explicitly marks the boundaries of the transaction. Although beans with container-managed transactions require less coding, they have one limitation: When a method is executing, it can be associated with either a single transaction or no transaction at all. If this limitation will make coding your bean difficult, you should consider using bean-managed transactions. Reference: The Java EE 5 Tutorial,Bean-Managed Transactions

Topics

#BMT#UserTransaction#exception propagation#TransactionRolledbackException

Community Discussion

No community discussion yet for this question.

Full 1Z0-895 Practice