-->
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: ERROR: SET AUTOCOMMIT TO OFF is no longer supported
PostPosted: Tue Feb 21, 2006 5:11 am 
Beginner
Beginner

Joined: Tue Aug 09, 2005 1:34 am
Posts: 26
Location: Bangalore
Hi,


Hibernate version:3.1

Mapping documents:Product.hbm.xml

I get ERROR: SET AUTOCOMMIT TO OFF is no longer supported

My Hibernate.cfg.xml is as follows
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
   "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>

    <!-- a SessionFactory instance listed as /jndi/name -->
    <session-factory>

        <!-- properties -->       
       
        <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
       <property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
       <property name="hibernate.connection.url">jdbc:postgresql://192.168.149.49:5432/DNA_Mann</property>
       <property name="hibernate.connection.username">postgres</property>
       <property name="hibernate.connection.password">postgres</property>
       <property name="hibernate.connection.autocommit">true</property>
       <!-- Enable Hibernate's automatic session context management -->
      
      <property name="current_session_context_class">thread</property>
      
        <property name="show_sql">true</property>
        <property name="use_outer_join">true</property>

        <!-- mapping files -->
      <!-- mapping resource="hibernate-config/com/infra/persistence/bean/Customer.hbm.xml"/ -->
        <!-- mapping resource="hibernate-config/com/infra/persistence/bean/Order.hbm.xml"/ -->
        <!-- mapping resource="hibernate-config/com/infra/persistence/bean/Orderitem.hbm.xml"/ -->
        <mapping resource="hibernate-config/com/infra/persistence/bean/Product.hbm.xml"/>
        <!-- mapping files -->       
    </session-factory>

</hibernate-configuration>


I get an exception in the following piece of code in The class ServLocatorImpl.java : -
Code:
private Session getSession() throws PersistenceException {
            Session session = ThrdSessionHolder.get();
            System.out.println("session is .." +session);
            //org.hibernate.Session session = GlobalSessionFactory.get().newSession();
            //ConnectionProvider cp = ConnectionProviderFactory.newConnectionProvider();
            //TODO Need to test the Connection
           [b] Connection conn = session.connection(); //I get the error here in this line[/b]
            System.out.println("conn is .." +conn);
            log.info("session.isConnected() :--> "+session.isConnected());
            if (!session.isConnected()) {
                try {
                   System.out.println("session object not connected");
                   session.reconnect(conn);
                } catch (HibernateException he) {
                   System.out.println("Exception obj is-->"+he);
                    throw new PersistenceException(PersistenceErrCodes.SESSION_ERROR, he);
                }
            }
            return session;
        }


Full stack trace of any exception that occurs:
2006-02-21 14:35:35,057 (org.hibernate.transaction.JDBCTransaction) - JDBC begin failed
java.sql.SQLException: ERROR: SET AUTOCOMMIT TO OFF is no longer supported

at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)
at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:482)
at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:461)
at org.postgresql.jdbc1.AbstractJdbc1Connection.setAutoCommit(AbstractJdbc1Connection.java:957)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1262)
at com.infra.persistence.service.TxnCmd.invokeSqlCommand(TxnCmd.java:20)
at com.infra.persistence.service.SrvLocatorImpl$ManagerDelegate.invoke(SrvLocatorImpl.java:96)
at $Proxy0.add(Unknown Source)
at com.infra.persistence.domain.FunctionalBusinessTest.addProduct(FunctionalBusinessTest.java:60)
at com.infra.persistence.domain.FunctionalBusinessTest.testProduct(FunctionalBusinessTest.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


Name and version of the database you are using:Postgres 8.0

The generated SQL (show_sql=true):session is ..SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[]])
2006-02-21 14:35:34,994 (org.hibernate.jdbc.JDBCContext) - opening user JDBC connection, application must close it
2006-02-21 14:35:34,994 (org.hibernate.connection.DriverManagerConnectionProvider) - total checked-out connections: 0
2006-02-21 14:35:34,994 (org.hibernate.connection.DriverManagerConnectionProvider) - using pooled JDBC connection, pool size: 0
conn is ..org.postgresql.jdbc3.Jdbc3Connection@1ff92f5
2006-02-21 14:35:34,994 (com.infra.persistence.service.SrvLocatorImpl$ManagerDelegate) - session.isConnected() :--> true
2006-02-21 14:35:35,010 (org.hibernate.transaction.JDBCTransaction) - begin
2006-02-21 14:35:35,010 (org.hibernate.jdbc.ConnectionManager) - opening JDBC connection
2006-02-21 14:35:35,010 (org.hibernate.connection.DriverManagerConnectionProvider) - total checked-out connections: 1
2006-02-21 14:35:35,010 (org.hibernate.connection.DriverManagerConnectionProvider) - opening new JDBC connection
2006-02-21 14:35:35,057 (org.hibernate.connection.DriverManagerConnectionProvider) - created connection to: jdbc:postgresql://192.168.149.49:5432/DNA_Mann, Isolation Level: 2
2006-02-21 14:35:35,057 (org.hibernate.transaction.JDBCTransaction) - current autocommit status: true
2006-02-21 14:35:35,057 (org.hibernate.transaction.JDBCTransaction) - disabling autocommit
2006-02-21 14:35:35,057 (org.hibernate.transaction.JDBCTransaction) - JDBC begin failed
java.sql.SQLException: ERROR: SET AUTOCOMMIT TO OFF is no longer supported

at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)
at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:482)
at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:461)
at org.postgresql.jdbc1.AbstractJdbc1Connection.setAutoCommit(AbstractJdbc1Connection.java:957)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1262)
at com.infra.persistence.service.TxnCmd.invokeSqlCommand(TxnCmd.java:20)
at com.infra.persistence.service.SrvLocatorImpl$ManagerDelegate.invoke(SrvLocatorImpl.java:96)
at $Proxy0.add(Unknown Source)
at com.infra.persistence.domain.FunctionalBusinessTest.addProduct(FunctionalBusinessTest.java:60)
at com.infra.persistence.domain.FunctionalBusinessTest.testProduct(FunctionalBusinessTest.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
2006-02-21 14:35:35,088 (org.hibernate.impl.SessionImpl) - opened session at timestamp: 4671540162920448
getSessionFactory().openSession() :SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[]])
2006-02-21 14:35:35,088 (org.hibernate.impl.SessionImpl) - opened session at timestamp: 4671540162920449
2006-02-21 14:35:35,088 (org.hibernate.impl.SessionImpl) - opened session at timestamp: 4671540162920450
getSessionFactory().openSession() :SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[]])
2006-02-21 14:35:35,088 (org.hibernate.impl.SessionImpl) - opened session at timestamp: 4671540162920451


Debug level Hibernate log excerpt:


Thanks in Advance for the solution.

Thanks
Manjith Kumar A.
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 21, 2006 5:48 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
postgress issue - update the driver.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 21, 2006 6:41 am 
Beginner
Beginner

Joined: Tue Aug 09, 2005 1:34 am
Posts: 26
Location: Bangalore
Thanks it worked well.
I feel postgres DataBase has lots of issues.


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.