we are migrating from JBoss 5.1 to JBoss 7 and at the same time from Hibernate 3.x to 4.
In one of the applications we have a problem now during startup in combination with Quartz scheduling.
During the initialization of Quartz during the startup, we allready access the HibernateSession via the HibernateConnection.getSession() method. In JBoss 7 with Hibernate4 this results in a Nullpointer Exception.
How ever adding a Thread.sleep(10000); in the getSessionFactory method seems to solve the issue, which leads us to believe, that the session is not available at the point of time during the start up where we want to access it.
Some inverstigations show, that in the JBoss5+Hibernate3.x version there was the following in the hibernate-configuration:
<session-factory name="APP_HibernateFactory" bean="jboss.har:service=HibernateFactory,name=APP_18">
THEAPP was the jndi-name of the datasource.
We believe, that we somehow have to declare this dependency like shown above in order to tell hibernate to wait until the availability of the datasource. In JBoss7 where we migrated to Hibernate4 we now have the persistence.xml and a standalone.xml, which seems to not provide such dependecy declarations or did we miss something?
Does anyone out there know how and where to set this dependecy in JBoss 7 / Hibernate4? Maybe the concept changed here but we were not able to find a clear statement or migration document for this specific issue.
Any hint and help is appreciated!