Showing posts with label requires_new. Show all posts
Showing posts with label requires_new. Show all posts

Thursday, May 8, 2008

EJB 2.x transaction attributes

dectxn is heavily influenced by the declarative style of transaction management in the Java world. See these links for information on transaction attributes in EJB 2.x and how to specify them.
  • TX_BEAN_MANAGED
  • TX_MANDATORY
  • TX_NOT_SUPPORTED
  • TX_REQUIRED
  • TX_REQUIRES_NEW
  • TX_SUPPORTS

Txn::requires_new

In the Java EE world the RequiresNew transaction attribute is defined as starting a new transaction after suspending any existing transaction. Transaction suspension is handled by the app server and support for this is app server specific.

The default Spring JtaTransactionManager does not support PROPAGATION_REQUIRES_NEW. Transaction suspension support is app server specific (no standard JNDI location for the JTA transaction manager). See here for further information on transaction suspension in Spring. Spring will by default throw an exception if a PROPAGATION_REQUIRES_NEW method is called from within an existing active tranaction.

dectxn Txn::requires_new follows the default Spring approach by raising a Txn::RequiresNewException if called from within an existing active transaction. If called with no active transaction it behaves as for Txn::required.