Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.2.3ga
Full stack trace of any exception that occurs:
java.lang.NullPointerException
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:505)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:423)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
at org.hibernate.loader.Loader.doQuery(Loader.java:673)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2136)
at org.hibernate.loader.Loader.list(Loader.java:2096)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305)
at de.vdb.testapp.dao.ApplicationPropertyDaoBase$2.doInHibernate(ApplicationPropertyDaoBase.java:418)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:339)
at de.vdb.testapp.dao.ApplicationPropertyDaoBase.findByUkProp(ApplicationPropertyDaoBase.java:408)
at de.vdb.testapp.dao.ApplicationPropertyDaoBase.findByUkProp(ApplicationPropertyDaoBase.java:380)
at de.vdb.testapp.dao.ApplicationPropertyDao.findByName(ApplicationPropertyDao.java:51)
at de.vdb.testapp.dao.ApplicationPropertyDao.findBooleanValue(ApplicationPropertyDao.java:170)
Name and version of the database you are using: Oracle 10g (
We have some strange problem with Hibernate and Oracle 10g. Under heavy load Hibernate tends to loose the database connection from time to time (see the stacktrace).
From the Hibernate sources:
Code:
private PreparedStatement getPreparedStatement(...)
...
line 505: result = conn.prepareStatement( sql );
}
The connection pool configuration in Tomcat:
Code:
<Resource name="jdbc/db_test2" auth="Container" type="oracle.jdbc.pool.OracleDataSource"
debug="0"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
url="jdbc:oracle:thin:@db_test2:1521:dbtest"
connectionCachingEnabled="true"
connectionCacheName="dbtest2"
connectionCacheProperties="{MinLimit=0, MaxLimit=20, InitialLimit=0}"
user="xxx"
password="xxx"
/>
Obviously the connection is null.
This might be a problem with Hibernate, with the connection pool (we use Tomcat's internal connection pooling) or the database driver.
After short time the connection is available again.
Any hints ?