Hi,
There is a very similar question posted to this one
here
but since there was not reply I have posted the question again.
This exception is thrown when I an using a hsql datasource, bound to a jndi name, TestDS, that is defined inside jboss. I am using jboss 3.2.5, and the problem doesnot happen if i declare the datasource inside my hibernate file. The underlying code in net.sf.hibernate.tool.hbm2ddl.SchemaUpdate, does a commit inside a managed transaction which causes the connection wrapper to throw an exception inside jboss. Is there any way that this can be done?
Thanks
- Karamvir
Hibernate version:
2.1.6
Mapping documents:
Code:
This is the code in my hibernate-cfg.xml file
<property name="connection.datasource">java:/TestDS</property>
<property name="hibernate.statement_cache.size">10</property>
<property name="show_sql">false</property>
<property name="use_outer_join">true</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="transaction.manager_lookup_class">net.sf.hibernate.transaction.JBossTransactionManagerLookup</property>
<property name="transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
<property name="dialect">net.sf.hibernate.dialect.HSQLDialect</property>
Full stack trace of any exception that occurs:Code:
16:01:00,499 INFO [SchemaUpdate] Running hbm2ddl schema update
16:01:00,499 INFO [SchemaUpdate] fetching database metadata
16:01:00,514 ERROR [SchemaUpdate] could not get database metadata
java.sql.SQLException: You cannot commit during a managed transaction!
at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcComm
it(BaseWrapperManagedConnection.java:525)
at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConne
ction.java:464)
at net.sf.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:
155)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.ja
va:198)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.
java:791)
Name and version of the database you are using:
HSQLDB