I an trying to write a webapp from scratch and I encountered this problem using hibernate.
When I logout and do a session.invalidate OR I hit F5 to refresh the page, succeeding calls to hibernate results in a lock up.
I am using spring 2.5, hibernate 3, and hsqldb 1.8.
PLease enlighten me on what I am missing.
here is a sample call to hibernate:
Code:
protected <T extends AbstractBean> T readObject(final String identifier, final Map<String, Object> map) {
return (T)getHibernateTemplate().execute(new HibernateCallback() {
@Override
public Object doInHibernate(Session session) throws HibernateException, SQLException {
session.enableFilter("patchFilter");
Query query = session.getNamedQuery(identifier);
for (String key : map.keySet()) {
Object obj = map.get(key);
Class type = obj.getClass();
try {
Query.class.getMethod("set" + type.getSimpleName(), new Class[] { String.class, type }).invoke(
query, new Object[] { key, obj });
} catch (Exception e) {
throw new RuntimeException("Illegal argument [" + key + "," + obj + "]");
}
}
return query.uniqueResult();
}
});
}
here is my hibernate config
Code:
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
...
<!-- JDBC connection pool (use the built-in one) -->
<property name="connection.pool_size">100</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- disable batching so HSQLDB will propagate errors correctly. -->
<property name="jdbc.batch_size">0</property>
<property name="show_sql">true</property>
<!-- -mapping files ....->
</session-factory>
</hibernate-configuration>