Goodday All
I had hibernate 2.1.8 running standalone in our app succesfully. Our shema generation was done using ant 1.6.2. All running 100%
I then started with the task of having hibernate running in jboss. I have a Sybase jndi datasource up and running in jboss which hibernate connects to and everything is working and all tests is passing. My problem is with the schema generation process. Initialy I launched this process from ant, but we ran into problems with the initial context not being available over the wire (RMI).
I then set the following property in the hibernate.cfg.xml:
"<property name="hbm2ddl.auto">create-drop</property>" - but I get the following error from jboss logs when the schema generation process is envoked:
----- START OF LOG ------
14:44:34,606 INFO [Environment] Hibernate 2.1.8
14:44:34,610 INFO [Environment] hibernate.properties not found
14:44:34,614 INFO [Environment] using CGLIB reflection optimizer
14:44:34,615 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
14:44:34,621 INFO [Configuration] configuring from resource: /hibernate.cfg.xml
14:44:34,621 INFO [Configuration] Configuration resource: /hibernate.cfg.xml
14:44:34,642 INFO [Configuration] Mapping resource: za/co/rmb/dv/domain/hibernate/RafAdminDataRecord.hbm.xml
14:44:35,303 INFO [Binder] Mapping class: za.co.rmb.dv.domain.hibernate.RafAdminDataRecord -> RafAdminDataRecord
14:44:35,500 INFO [Configuration] Configured SessionFactory: null
14:44:35,732 INFO [Configuration] processing one-to-many association mappings
14:44:35,733 INFO [Configuration] processing one-to-one association property references
14:44:35,734 INFO [Configuration] processing foreign key constraints
14:44:35,913 INFO [Dialect] Using dialect: net.sf.hibernate.dialect.SybaseDialect
14:44:35,929 INFO [SettingsFactory] Use outer join fetching: true
14:44:35,941 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.provider.url=jnp://localhost:1099}
14:44:35,943 INFO [DatasourceConnectionProvider] Using datasource: java:/rafDataSource
14:44:35,952 INFO [TransactionManagerLookupFactory] No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
14:44:36,429 INFO [SettingsFactory] Use scrollable result sets: true
14:44:36,430 INFO [SettingsFactory] Use JDBC3 getGeneratedKeys(): false
14:44:36,430 INFO [SettingsFactory] Optimize cache for minimal puts: false
14:44:36,431 INFO [SettingsFactory] echoing all SQL to stdout
14:44:36,432 INFO [SettingsFactory] Query language substitutions: {}
14:44:36,433 INFO [SettingsFactory] cache provider: net.sf.hibernate.cache.EhCacheProvider
14:44:36,442 INFO [Configuration] instantiating and configuring caches
14:44:36,464 WARN [Configurator] No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/opt/jboss/jboss-4.0.0/server/default/lib/ehcache-0.9.jar!/ehcache-failsafe.xml
14:44:36,660 INFO [SessionFactoryImpl] building session factory
14:44:37,077 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
14:44:37,083 INFO [Dialect] Using dialect: net.sf.hibernate.dialect.SybaseDialect
14:44:37,085 INFO [Configuration] processing one-to-many association mappings
14:44:37,086 INFO [Configuration] processing one-to-one association property references
14:44:37,086 INFO [Configuration] processing foreign key constraints
14:44:37,088 INFO [Configuration] processing one-to-many association mappings
14:44:37,089 INFO [Configuration] processing one-to-one association property references
14:44:37,090 INFO [Configuration] processing foreign key constraints
14:44:37,093 INFO [SchemaExport] Running hbm2ddl schema export
14:44:37,095 INFO [SchemaExport] exporting generated schema to database
14:44:37,096 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.provider.url=jnp://localhost:1099}
14:44:37,098 INFO [DatasourceConnectionProvider] Using datasource: java:/rafDataSource
14:44:37,100 ERROR [SchemaExport] schema export unsuccessful
java.sql.SQLException: You cannot commit during a managed transaction!
at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:499)
at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:451)
at net.sf.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:121)
at net.sf.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:84)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:198)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:805)
at za.co.rmb.dv.domain.hibernate.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:29)
at za.co.rmb.dv.domain.hibernate.RafVisitor.visit(RafVisitor.java:39)
at za.co.rmb.dv.domain.hibernate.RafUpdateWrapper.accept(RafUpdateWrapper.java:14)
at za.co.rmb.dv.service.finance.raf.RafAdminRecordConsumer.onMessage(RafAdminRecordConsumer.java:43)
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:585)
at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:475)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:87)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:316)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:149)
at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:95)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:389)
at org.jboss.ejb.Container.invoke(Container.java:854)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:920)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1213)
at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:877)
at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:159)
at org.jboss.mq.SpySession.run(SpySession.java:351)
at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
at java.lang.Thread.run(Thread.java:595)
14:44:37,130 INFO [Dialect] Using dialect: net.sf.hibernate.dialect.SybaseDialect
14:44:37,133 INFO [Configuration] processing one-to-many association mappings
14:44:37,135 INFO [Configuration] processing one-to-one association property references
14:44:37,138 INFO [Configuration] processing foreign key constraints
14:44:37,140 INFO [Configuration] processing one-to-many association mappings
14:44:37,143 INFO [Configuration] processing one-to-one association property references
14:44:37,145 INFO [Configuration] processing foreign key constraints
----- END OF LOG ------
What I don't understand is why the exception is thrown :
" java.sql.SQLException: You cannot commit during a managed transaction! "
Are there any other way to do the Schema generation?
Thanks alot for a GREAT product !!!
Leon
|