I am using Hibernate 2.1
and following code represents the problem:
Configuration cfg = new Configuration();
cfg.configure();
SessionFactory sessionFactory = cfg.buildSessionFactory();
NewInfraResource res = (NewInfraResource)hSession.get(NewInfraResource.class, new Long(1));
hSession.close();
hSession = sessionFactory.openSession();
NewInfraResource res1 = (NewInfraResource)hSession.load(NewInfraResource.class, new Long(1));
transaction.commit();
hSession.close();
if fails on the second load with : net.sf.hibernate.HibernateException: Session is currently disconnected.
I looked into the hSession.connection() and found out that I am getting the same jdbc Connection object that I closed.
setting hibernate.connection.pool_size to "0" resolves the problem.
So I suspect that default jdbc DriverManger pooling has a bug returning closed connections?
Thanks.
|