Book Image

EJB 3 Developer Guide

By : Michael Sikora
Book Image

EJB 3 Developer Guide

By: Michael Sikora

Overview of this book

Table of Contents (18 chapters)
EJB 3 Developer Guide
Credits
About the Author
About the Reviewers
Preface
Annotations and Their Corresponding Packages

MDBs and Transactions


Because JMS decouples the message producer from the consumer, it is not possible for a transaction to span the sending and receipt of a message. For example, you cannot have a transaction starting when a client sends a message to a recipient and committing after the client has received confirmation. In many cases a client does not know who the recipient is. Even if such transactions were possible, they would be very long running. Good transaction design encourages keeping transactions short.

Consequently the only transaction attributes available when using Container Managed Transactions (CMT) with MDBs are Required and Not_Supported. The remaining transaction attributes deal with client initiated transactions, so are not applicable to MDBs. An MDB with the Required attribute will always execute in a new transaction. As with session beans, we would use the Not_Supported attribute if the MDB writes to a legacy database or simple file system which does not support transactions...