Transaction types

In “Creating the MDB” on page 567 we specified the transaction as Bean.

Specifying Container would have these consequences:

  • The default container transaction type is Required. That means that a transaction is started for the onMessage method. The resources that are part of this transaction are the messages.

  • This transaction would also be used for the database access in the CMP beans, and the database is another resource.

  • The synchronization of multiple resources requires two-phase commit.

  • For the CMP we used a regular JDBC driver, not the XA-compliant driver that supports two-phase commit.

  • At the first database access, we get an error message that the resource cannot be added:

     TransactionIm E WTRN0063E: An illegal attempt to enlist ...

Get EJB 2.0 Development with WebSphere Studio Application Developer 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.