Using Transactions with Message-Driven Beans

As with session beans, message-driven beans can use either bean-managed transactions or container-managed transactions. Because a client has no way to call the message-driven bean directly, the client can’t propagate its transaction context to the message-driven bean. The container will always call the onMessage method with a transaction context that is specified in the bean’s deployment descriptor.

Therefore, a message-driven bean that is using container-managed transaction should specify either the Required or NotSupported transaction attribute in the ejb-jar.xml file. This is because if the message-driven bean needs a transaction, the container will have to create one before calling the onMessage ...

Get Special Edition Using Enterprise JavaBeans™ 2.0 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.