Marking transactions in the DD

All beans must say whether they’re using bean- or container-managed transactions. For BMT beans, that’s it for the DD.

But for CMT beans that’s just the beginning.

image with no caption

Transaction-related DD info lives in two places

  1. For both CMT and BMT beans:

    The <transaction-type> element in the <enterprise-beans> section

    image with no caption
  2. For CMT beans only:

    The <container-transaction> element in the <assembly-descriptor> section

    <assembly-descriptor>
      <container-transaction>
         <method>
            <ejb-name>MyBean</ejb-name>
            <method-name>bar</method-name>
         </method>
         <trans-attribute>Required</trans-attribute>
      </container-transaction>
    </assembly-descriptor>
    image with no caption

Get Head First EJB 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.