Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Overview

The JtaUniOfWorkListener is a UnitOfWorkListener that makes the Unit Of Work transaction aware of JTA transactions.

JTA (Java Transaction API) is the standard transaction API in J2EE.

Definition

You can define the JtaUniOfWorkListener in two ways, either using the SpringAspectContainer configuration file aware-config.xml or using a regular Java API.

Java API

Specify the org.codehaus.aware.unitofwork.jta.JtaUnitOfWorkListener class as one of the listeners in the Class array passed to the UnitOfWork.initialize() method.

Code Block
java
java
UnitOfWork.initialize(new Class[]{JtaUnitOfWorkListener.class});

Spring definition

Specify the org.codehaus.aware.unitofwork.jta.JtaUnitOfWorkListener class name as one of the listeners in the property listeners.

Code Block
xml
xml
<bean id="org.codehaus.aware.unitofwork.UnitOfWorkProtocol"
     class="org.codehaus.aware.unitofwork.UnitOfWorkProtocol"
    singleton="false">

    <property name="listeners">
        <list>
            <value>org.codehaus.aware.unitofwork.jta.JtaUnitOfWorkListener</value>
             ...
        </list>
    </property>

</bean>

For the Spring definition to work you have to define the UnitOfWorkProtocol to use the SpringAspectContainer and not the default one.