Q&A

Q1:Which type of EJBs can use container-managed transactions? And with which transaction option?
A1: All types of EJBs (session, message-driven, and entity beans) can use container-managed transactions, with either the JDBC or JTA transaction option.
Q2:What are the acceptable values of the transaction attribute?
A2: There are six values that can be specified for the transaction attribute: Required, RequiresNew, NotSupported, Mandatory, Never, and Supports.
Q3:How do you configure the EJB to be a CMT?
A3: You must set the <transaction-type> element in the standard deployment descriptor ejb-jar.xml to the Container value. You must also specify the <transaction-attribute> for either the entire EJB or for specific methods of the EJB.

Get Sams Teach Yourself EJB in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.