-->
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: autocommit problem
PostPosted: Thu Nov 20, 2003 9:39 am 
Newbie

Joined: Tue Aug 26, 2003 7:50 am
Posts: 2
I'm developing an web application usign Hibernate. I can insert and delete normally but when I try to update an information, I get an java.sql.SQLException: Can't call rollback when autocommit=true .

How can I set the autocommit to false?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 20, 2003 9:48 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Hibernate disables autocommit if you use the JDBCTransactionFactory, which is the default if you don't specify anything else.

Before starting a transaction:

toggleAutoCommit = session.connection().getAutoCommit();
if (toggleAutoCommit) session.connection().setAutoCommit(false);

After transaction:

if (toggleAutoCommit) session.connection().setAutoCommit(true);

So, either your JDBC Connection doesn't return the proper value on "getAutoCommit()", which can be a bug in the JDBC driver or something else in your setup is broken. I always turn off any autocommit in the global database configuration.

Can you show us the full stack trace and verify that your JDBC driver returns the correct value on "getAutoCommit()"?

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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.