RUFFIE wrote:
I got the same problem. I see the topicstarter is using the hibernate tutorial provided on the myeclipseide.com website.
So am I.
Has anyone had a solution for this yet?
You should adapt the SessionFactory (seen at laliluna)
Code:
public static Session currentSession() throws HibernateException {
Session session = (Session) threadLocal.get();
if (session != null && !session.isOpen())
session = null;
if (session == null) {
if (sessionFactory == null) {
try {
cfg.configure(CONFIG_FILE_LOCATION);
sessionFactory = cfg.buildSessionFactory();
} catch (Exception e) {
System.err
.println("%%%% Error Creating HibernateSessionFactory %%%%");
e.printStackTrace();
}
}
session = sessionFactory.openSession();
threadLocal.set(session);
}
return session;
}
then it should work without beeing closed all the time
greetings Martin