Is it at all possible to have a JTA Transaction that makes an entry into an InnoDB table?
Ive tried just about everything I can think of and I cannot get it to work.
My java code:
Code:
UserTransaction tx = (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction");
try{
Customer ctmr = new Customer("abc", "def");
tx.begin();
sessionFactory.getCurrentSession().save(ctmr);
tx.commit();
}catch(Exception e){
tx.rollback();
}
My Hibernate.cfg.xml file:Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.url">........</property>
<property name="connection.username">.......</property>
<property
<property name="connection.password">.......</property>
<property name="connection.pool_size">2</property>
<property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="current_session_context_class">org.hibernate.context.JTASessionContext</property>
<property name="transaction.manager_lookup_class">org.hibernate.transaction.SunONETransactionManagerLookup</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
<!-- this will show us all sql statements -->
<property name="hibernate.show_sql">true</property>
<!-- this will create the database tables for us -->
<property name="hibernate.hbm2ddl.auto">create</property>
</session-factory>
</hibernate-configuration>
I am using MySQL version 5.0.20.
I
can make an enty into my InnoDB table using ordinary JDBC transactions. But I also need to get it working for JTA transaction (i.e. UserTransaction). This is because eventually I would like to have one JTA transction in which I update more than one database.
Any help in this matter would be appreciated.
Torch.