DD example for CMT

In the <enterprise-beans> element

image with no caption

In the <assembly-descriptor> element

<assembly-descriptor>
  <container-transaction>
     <method>
        <ejb-name>MyOtherBean</ejb-name>
        <method-name>foo</method-name>
     </method>
     <trans-attribute>RequiresNew</trans-attribute>
  </container-transaction>
</assembly-descriptor>

Note

there are a few variations of the <method> element (we’ll look at them on the next page)

You specify attributes by listing a specific attribute (RequiresNew, Supports, etc.) and putting in all of the methods that are supposed to have that attribute. You might think you’re supposed to first specify a method and then give the attribute for that method (because that’s how it looks in this example), but that’s not how it works. It’ll all make sense on the next page...

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.