views:

851

answers:

3

i have looked for and compreensive article on this and have yet to find one good enough.

Can some one explain to me the workings of the transaction types? (Required, RequiresNew, Mandatory, Never...) and mainly how these affect service calls between services with diferent types?

+3  A: 

A developer's guide to EJB transaction management seems like a pretty comprehensive guide to me.

cletus
The link is dead.
Michael Barker
A: 

Enterprise Java Beans 3.0 by Bill Burke and Richard Monson Haefel is an excellent reference for anything to do with EJB3. The txn attributes are pretty easy in fact. Basically you use these at method level in EJBs using annotation.

  1. Required means to run that method a txn is required. If the caller was in a txn it will be used. If not a new txn will be created and used.
  2. RequiresNew means a new txn is needed to run that method. If the caller was in a txn it will be suspended and a new txn created and used. If not a new txn will be created and used
  3. Mandatory means the caller needs to be in a txn when calling the said method. Otherwise an error is raised.
  4. Supports means the method doesnt care if the caller was in a txn or not.
  5. NotSupported - if the caller was in a txn that txn will be suspended and the method will be run without a txn.
  6. Never - same as NotSupported but this one will raise an error if the caller had a txn but NotSupported wont raise an error.
OpenSource
A: 

Mastering Enterprise JavaBeans 3.0, Wiley.

Available free at:

http://www.theserverside.com/tt/books/wiley/masteringEJB3/index.tss

See ch. 10.

Conor