I have five session factories for 5 different datasources. These are spread out over 3 different packages but all are initialized in the same manner. Four of them work correctly, but the fifth fails on the creation of the session factory with an error stating that you cannot commit within a transaction block while it tries to fetch the database metadata.
This behavior remains constant regardless of which configuration file and mappings I use. All configurations get beyond this problem if they are not initalized from this specific session factory.
Everything is running inside of jboss-3.2.7. All datasources have been configured with jboss.jca:service=LocalTxCM.
I'm completely confused and any help or pointers in the correct direction would be appreciated.
Hibernate version: 3.0.2/3.0.5
Full stack trace of any exception that occurs:
2005-06-01 15:59:55,825 [main] INFO [org.hibernate.connection.DatasourceConnectionProvider] Using datasource: java:jdbc/appDS
2005-06-01 15:59:55,825 [main] INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] Running hbm2ddl schema update
2005-06-01 15:59:55,825 [main] INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] fetching database metadata
2005-06-01 15:59:55,825 [main] ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] could not get database metadata
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:473)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:120)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:260)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1055)
at net.vocalocity.appcenter.server.common.persistence.AppHibernateSessionFactory.<clinit>(AppHibernateSessionFactory.java:43)
AppHibernateSessionFactory:43
Code:
sessionFactory = new Configuration().configure( propertiesFile ).setProperty( Environment.HBM2DDL_AUTO,
"update" ).buildSessionFactory();
Databases:
Postgres 8.0 and Firebird 1.5