When the application starts, it works fine, but after many update operations, it throws an exception:
[Request processing failed; nested exception is org.hibernate.exception.GenericJDBCException: Could not open connection] with root cause java.util.NoSuchElementException: Timeout waiting for idle object
private SessionFactory sessionFactory;
public SessionFactory getSessionFactory() {
return sessionFactory;
}
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
protected Session openSession() {
return getSessionFactory().openSession();
}
public void deleteAnyType(T t){
Session session =super.openSession();
session.delete(t);
session.beginTransaction().commit();
session.close();
}