I have problem with Hibernate (hibernate-core-4.1.9.Final.jar)
Case 1: Hibernate testing inside for loop. Everything went well.
for(in
I had the same issue just because I forgot to wrap my hibernate code in a transaction. Apparently the connection to DB is not closed until you commit a transaction. Here is a valid example:
Session session = HibernateUtils.getSession();
Transaction tx = session.beginTransaction();
Category cat = null;
try{
cat = (Category)session.get(Category.class, 1);
tx.commit();
}catch(Exception ex){
tx.rollback();
}finally{
session.close();
}
return cat;