Thursday, May 8, 2008

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.

No comments: