-->
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.  [ 4 posts ] 
Author Message
 Post subject: autocommit=true error
PostPosted: Tue Aug 31, 2004 8:05 pm 
Newbie

Joined: Tue Aug 31, 2004 5:04 pm
Posts: 10
Hibernate version:2.1
Mapping documents:custom
Full stack trace of any exception that occurs:
Name and version of the database you are using:MySQL 4


Hello, I am getting the following error:
Code:
WARNING: SQL Error: 0, SQLState: S1000
Aug 31, 2004 4:31:53 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Can't call commit when autocommit=true
Aug 31, 2004 4:31:53 PM net.sf.hibernate.JDBCException <init>
SEVERE: Could not save object


I have the following in a file to turnoff autoCommit. Is this not correct? Thanks for your help.

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-configuration
   PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
   "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
   <session-factory name="java:/hibernate/HiberateFactory">
   
      <!-- Use a Tomcat JNDI datasource -->
      <property name="connection.datasource">java:comp/env/jdbc/kuvata</property>
      <property name="autoCommit">false</property>
      <property name="show_sql">true</property>
      <property name="use_outer_join">true</property>
      <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
      
      <mapping info..........>
      
   </session-factory>
</hibernate-configuration>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 31, 2004 8:10 pm 
Newbie

Joined: Tue Aug 31, 2004 5:04 pm
Posts: 10
Doesn't appear that I can edit my post. Here is a bit more from the console window. I don't have the log running correctly.

Code:
Aug 31, 2004 4:31:53 PM net.sf.hibernate.util.JDBCExceptionReporter logException
s
WARNING: SQL Error: 0, SQLState: S1000
Aug 31, 2004 4:31:53 PM net.sf.hibernate.util.JDBCExceptionReporter logException
s
SEVERE: Can't call commit when autocommit=true
Aug 31, 2004 4:31:53 PM net.sf.hibernate.JDBCException <init>
SEVERE: Could not save object
java.sql.SQLException: Can't call commit when autocommit=true
        at com.mysql.jdbc.Connection.commit(Connection.java:1136)
        at org.apache.commons.dbcp.DelegatingConnection.commit(DelegatingConnect
ion.java:248)
        at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.
commit(PoolingDataSource.java:244)
        at net.sf.hibernate.id.TableGenerator.generate(TableGenerator.java:126)
        at net.sf.hibernate.id.TableHiLoGenerator.generate(TableHiLoGenerator.ja
va:59)
        at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(Session
Impl.java:758)
        at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:731)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 31, 2004 8:11 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Don't use autocommit.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 01, 2004 5:12 pm 
Newbie

Joined: Thu Jul 22, 2004 4:32 pm
Posts: 6
Location: Sacramento, CA USA
I have a similar issue. I'm running my application on the JBoss
application server (not using CMT, by the way). Hibernate is getting
the data source from the JNDI and my code doesn't appear to have
access to the connection to set autocommit to false.

Is there some way to get Hibernate to do this?

I looked at the code in the TableGenerator.java, which gets a
connection, does its work, then calls commit() on it. How do we
get ahold of the connection object to call setAutoCommit(false)?

Thanks,


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