-->
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.  [ 2 posts ] 
Author Message
 Post subject: JTATransactionFactory: data not saved
PostPosted: Sat Oct 14, 2006 8:18 am 
Newbie

Joined: Tue Oct 04, 2005 1:35 am
Posts: 12
Hi all,
I want to configure my hibernate for JBoss. i have given hibernate.cfg.file contents below. My problem is that, when I call tx.commit, nothing is commited to Database. No add/update/delete operation gets reflected in tables

my Code is as simple as below:


Session currentSession = HibernateUtils.currentSession();
Transaction tx =currentSession.beginTransaction();
currentSession.save(myObj); //myObject is Dataobj
tx.commit();
currentSession.close();


Please can anybody tell me why data is not getting saved to DB?
Thanks in advance


Hibernate version: 3.0

Mapping documents: <property name="connection.autoReconnect">true</property>
<property name="connection.autoReconnectForPools">true</property>
<property name="connection.is-connection-validation-required">true</property>
<property name="show_sql">true</property>
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.timeout">1800</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
<property name="hibernate.cache.use_query_cache">false</property>
<property name="hibernate.cache.use_second_level_cache">false</property>
<property name="jta.UserTransaction">UserTransaction</property>


Name and version of the database you are using: MySQL 5.0


Top
 Profile  
 
 Post subject: Use flush()
PostPosted: Sat Oct 14, 2006 9:40 am 
Beginner
Beginner

Joined: Thu Jul 06, 2006 11:09 pm
Posts: 25
I've already experienced this one. Try using the session.flush(). Then don't forget to close the session. Try looking at the logs. When you something like:

skipping auto-flush due to session closed

It only means that you all the transactions (add/edit/delete) were already there but not directly applied to the database itself.[/code]

_________________
Don't forget to rate.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.