-->
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.  [ 3 posts ] 
Author Message
 Post subject: sess.flush() and commits
PostPosted: Fri Oct 31, 2003 12:37 pm 
Newbie

Joined: Fri Oct 31, 2003 12:19 pm
Posts: 1
Is it at all possible that calls to sess.flush() would cause the transaction to commit? I've been debugging a problem where we're rolling back a transaction, but changes are still being committed.

Here is what I am doing...

Code:
try{
    begin tx;
    sess.update(obj);  // causes version update
    sess.flush();

    do some more updates to other objects;
    sess.flush();

    do some more updates to yet other objects;
    sess.flush();

    throw new Exception();  // debugging exception thrown.

    // commit would normally be here;
} catch (Exception e) {
    rollback tx;
} finally {
    close sess;
}


I'm flushing at each point because I'm capturing timing information for each step. It's not necessary, but I thought that flush() just caused the SQL statements to be sent to the database. If I get rid of the second two flushes, the first object's version number gets committed to the db. If I get rid of all the flushes, everything rolls back as expected.

Does anyone know what could be causing the problem? Thanks in advance.

-Matt
Code:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 31, 2003 3:45 pm 
Regular
Regular

Joined: Tue Sep 16, 2003 11:35 am
Posts: 93
Location: San Francisco, CA
can you give us some info on the database you're using and the Hibernate version?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 31, 2003 8:53 pm 
Expert
Expert

Joined: Tue Sep 16, 2003 4:06 pm
Posts: 318
Location: St. Petersburg, Russia
either
1. you are using MySQL with MyISAM tables (do not support transactions at all)
2. you are not configuring datasource for Hibernate and provide it with Connection objects and these Connections are in autocommit mode (setAutoCommit(true))
3. Something else :)


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