In mu web application after some time nearly 5-6 H. threadLocal Session instance return is null value.
Why this is happened i not under stand.

we used configuration.

<property name="connection.pool_size">50</property>
<!-- Enable hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>

we use this function for getSession.but this return Null value after 5 to 6 H web site running.

public static Session getSession() throws HibernateException {
Session session = (Session) threadLocal.get();

if (session == null || !session.isOpen()) {
if (sessionFactory == null) {
rebuildSessionFactory();
}
session = (sessionFactory != null) ? sessionFactory.openSession()
: null;
threadLocal.set(session);
}

return session;
}

Any one help me for resolving this Problem.