Solution :
Please do below changes in your HibernateUtil:
public static Session getHibernateSession() {
final SessionFactory sf = new Configuration()
.configure("yourConfig.cfg.xml").buildSessionFactory();
// factory = new Configuration().configure().buildSessionFactory();
final Session session = sf.openSession();
return session;
}
And instead of using the SessionFactory use the Session:
final Session session = HibernateUtil.getHibernateSession();
And after that use the below code:
Transaction tx = session.beginTransaction();
// all your methods
tx.commit();
session.close();
Hope this helps you in resolving your issue.
And you can actually remove that connection pool property from your hbm if you do not need it.