-->
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: SchemaExport and CMT transaction
PostPosted: Fri Dec 17, 2004 10:52 am 
Regular
Regular

Joined: Fri Dec 17, 2004 10:38 am
Posts: 54
During programmatic schema export with CMT transactions following exception occurs.
This happend due to following code in SchemaExport.java (around 121 line)
Code:
if ( !connection.getAutoCommit() ) {
    connection.commit();
    connection.setAutoCommit(true);
}


Is there any way to avoid implicit connection.commit() (or disable connection's autocomit feature)?

Hibernate version:
2.1.7c
Full stack trace of any exception that occurs:
java.sql.SQLException: You cannot commit during a managed transaction!
at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:525)
at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:464)
at net.sf.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:121)
at net.sf.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:84)
at install.InitializerHibernateImpl.createTables(InitializerHibernateImpl.java:70)
...
Name and version of the database you are using:
MySQL 4.0.21, connection provided via JBoss datasource
JCA connector configuration:
Code:
<datasources>
  <local-tx-datasource>
    <jndi-name>mysql</jndi-name>
    <connection-url>jdbc:mysql://localhost:3306/DB?useUnicode=true&amp;characterEncoding=UTF-8</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>scot</user-name>
    <password>tiger</password>
  </local-tx-datasource>
</datasources>


Hibernate configuration
Code:
<hibernate-configuration>

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

      <!-- properties -->
      <property name="connection.datasource">java:/mysql</property>
      <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
      <property name="show_sql">true</property>
      <property name="use_outer_join">false</property>
      <property name="transaction.manager_lookup_class">net.sf.hibernate.transaction.JBossTransactionManagerLookup</property>
         <property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>

      <!-- mapping files -->
                ...
   </session-factory>

</hibernate-configuration>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 17, 2004 11:13 am 
Regular
Regular

Joined: Fri Dec 17, 2004 10:38 am
Posts: 54
sorry for crossposting. same question asked here:
http://forum.hibernate.org/viewtopic.php?t=935932&start=0&postdays=0&postorder=asc


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.