[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - JBOSS XA Transaction Not working

me_zeta_me do-not-reply at jboss.com
Mon Oct 30 06:57:07 EST 2006


Hi all
   I am getting problems using XA connection, please help

  I am using SessionBeans with container managed transaction. From my ejb code i am getting 2 xa connections. and doing some updates but if one of the updates fails transaction is not rolledback.

MysqlXADataSource myXa1 = new MysqlXADataSource();
MysqlXADataSource myXa2 = new MysqlXADataSource();
myXa1.setUrl("jdbc:mysql://host1:3306/his_db1");
myXa1.setUser("user1");
myXa1.setPassword("pass1");

myXa2.setUrl("jdbc:mysql://host2:3306/db2");
myXa2.setUser("user2");
myXa2.setPassword("saras123");


then enlisting it to the transaction and calling the corresponding update methods.

 tm.getTransaction().enlistResource(myXa1.getXAConnection().getXAResource())
updateDB1(myXa1.getConnection());
tm.getTransaction().enlistResource(myXa2.getXAConnection().getXAResource())){
updateDB2(myXa2.getConnection());


but if updateDB1() has some exception still updateDB2() the db2 is getthing updated

am i doing some thing wrong or am i missing some thing 

pleas help

zeta

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981738#3981738

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981738



More information about the jboss-user mailing list