-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: JTA Transaction with InnoDB Tables
PostPosted: Thu Sep 07, 2006 9:54 pm 
Newbie

Joined: Thu Sep 07, 2006 9:33 pm
Posts: 4
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 07, 2006 10:39 pm 
Newbie

Joined: Thu Sep 07, 2006 9:33 pm
Posts: 4
Just to add one more point, The UserTransaction works perfectly when I use MyISAM tables. However, when I try it with InnoDB tables it does not work.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 11, 2006 7:09 pm 
Regular
Regular

Joined: Wed Apr 12, 2006 12:49 am
Posts: 105
Location: Malaysia
Hi Torch,

I face the problem similar with yours where hibernate is not performing update statement to do update.

Have you found out the cause or solution? If so, really appreciate if you don't mind to share with me.

Thanks in advance.

_________________
Thank you.

Regards,
Jap.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 11, 2006 7:41 pm 
Newbie

Joined: Thu Aug 03, 2006 6:54 pm
Posts: 16
Unfortunately nothing as yet.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 19, 2006 11:14 pm 
Regular
Regular

Joined: Wed Apr 12, 2006 12:49 am
Posts: 105
Location: Malaysia
After session.save(), include session.flush() as well and see if it works for you?

Mine can work after include session.flush().

_________________
Thank you.

Regards,
Jap.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 23, 2006 9:44 pm 
Regular
Regular

Joined: Wed Apr 12, 2006 12:49 am
Posts: 105
Location: Malaysia
Hi outlaw,

How is it? does it work for your case?

_________________
Thank you.

Regards,
Jap.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.