2 Replies Latest reply on Jan 13, 2008 2:42 PM by Anton Lunev

    how to turn off autocommit to false ?

    jeremie lapoutre Newbie

      I have the following error :

      15:36:38,828 ERROR [SchemaExport] schema export unsuccessful
      java.sql.SQLException: You cannot set autocommit during a managed transaction!
      


      my data base conf file is the following :

      <?xml version="1.0" encoding="UTF-8"?>
      
      <!-- $Id: mysql-ds.xml,v 1.3.2.3 2006/02/07 14:23:00 acoliver Exp $ -->
      <!-- Datasource config for MySQL using 3.0.9 available from:
      http://www.mysql.com/downloads/api-jdbc-stable.html
      -->
      
      <datasources>
       <local-tx-datasource>
       <jndi-name>MySqlDS</jndi-name>
       <connection-url>jdbc:mysql://localhost:3306/test</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name>dbadmin</user-name>
       <password>dbadmin</password>
       <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
      
       <connection-property name="autoReconnect">false</connection-property>
      
       <!-- should only be used on drivers after 3.22.1 with "ping" support
       <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
       -->
       <!-- sql to call when connection is created
       <new-connection-sql>some arbitrary sql</new-connection-sql>
       -->
       <!-- sql to call on an existing pooled connection when it is obtained from pool - MySQLValidConnectionChecker is preferred for newer drivers
       <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
       -->
      
       <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
       <metadata>
       <type-mapping>mySQL</type-mapping>
       </metadata>
       </local-tx-datasource>
      </datasources>
      


      I use Hibernate3.1.3 through hivetranse.

      hivetranse is a library to manage hibernate session using hivemind.

      it provides the session and start and commit transaction when necessary.
      I set up hibernate to lookup the datasource.
      and to use JTA :

      hivemodule.xml :
       <property name="hibernate.connection.datasource" value="${as.datasource}"/>
       <property name="hibernate.transaction.factory_class" value="${as.transaction.factory.class}"/>
       <property name="hibernate.transaction.manager_lookup_class" value="${as.transaction_manager_lookup_class}"/>
       <property name="hibernate.connection.provider_class" value="${as.connection.provider_class}"/>
      
      ...
      
      <contribution configuration-id="hivemind.ApplicationDefaults">
      
       <default symbol="db.dialect" value="org.hibernate.dialect.MySQLDialect"/>
       <default symbol="as.datasource" value="java:MySqlDS"/>
       <default symbol="as.transaction.factory.class" value="org.hibernate.transaction.JTATransactionFactory"/>
       <default symbol="as.transaction_manager_lookup_class"
       value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
       <default symbol="as.transaction.provider_class" value="org.hibernate.connection.DatasourceConnectionProvider"/>
      
      </contribution>
      
      
      


      if you have any idea.
      thanks