User: mulder
Date: 00/10/21 09:29:26
Added: src/resources/xa/META-INF ejb-jar.xml jboss.xml
Log:
Added a test of 2-phase commit.
This creates 3 connections across 2 data sources and does work on them
and commits them together as a 2-phase commit transaction.
You must create DB Pools "XADataSource1" and "XADataSource2" pointing to
different DBs, and create a table in each - it'll spew out the table
create statement if you run it and it can't find the tables.
Revision Changes Path
1.1 jbosstest/src/resources/xa/META-INF/ejb-jar.xml
Index: ejb-jar.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>XATest</ejb-name>
<home>org.jboss.test.xa.interfaces.XATestHome</home>
<remote>org.jboss.test.xa.interfaces.XATest</remote>
<ejb-class>org.jboss.test.xa.bean.XATestBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<res-ref-name>jdbc/DBConnection1</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<res-ref-name>jdbc/DBConnection2</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<description>XA_Required</description>
<method>
<ejb-name>XATest</ejb-name>
<method-intf>Home</method-intf>
<method-name>create</method-name>
<method-params />
</method>
<method>
<ejb-name>XATest</ejb-name>
<method-intf>Home</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>java.lang.Object</method-param>
</method-params>
</method>
<method>
<ejb-name>XATest</ejb-name>
<method-intf>Home</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>javax.ejb.Handle</method-param>
</method-params>
</method>
<method>
<ejb-name>XATest</ejb-name>
<method-intf>Remote</method-intf>
<method-name>clearData</method-name>
<method-params />
</method>
<method>
<ejb-name>XATest</ejb-name>
<method-intf>Remote</method-intf>
<method-name>doWork</method-name>
<method-params />
</method>
<method>
<ejb-name>XATest</ejb-name>
<method-intf>Remote</method-intf>
<method-name>remove</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
1.1 jbosstest/src/resources/xa/META-INF/jboss.xml
Index: jboss.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<jboss>
<secure>false</secure>
<container-configurations />
<resource-managers>
<resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
<res-name>DB1</res-name>
<res-jndi-name>XADataSource1</res-jndi-name>
</resource-manager>
<resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
<res-name>DB2</res-name>
<res-jndi-name>XADataSource2</res-jndi-name>
</resource-manager>
</resource-managers>
<enterprise-beans>
<session>
<ejb-name>XATest</ejb-name>
<jndi-name>XATest</jndi-name>
<configuration-name></configuration-name>
<resource-ref>
<res-ref-name>jdbc/DBConnection1</res-ref-name>
<resource-name>DB1</resource-name>
</resource-ref>
<resource-ref>
<res-ref-name>jdbc/DBConnection2</res-ref-name>
<resource-name>DB2</resource-name>
</resource-ref>
</session>
</enterprise-beans>
</jboss>