Answers for "hibernate session management"

0

hibernate session management

Session session = factory.openSession();
Transaction tx = null;

try {
   tx = session.beginTransaction();
   // do some work
   ...
   tx.commit();
}

catch (Exception e) {
   if (tx!=null) tx.rollback();
   e.printStackTrace(); 
} finally {
   session.close();
}
Posted by: Guest on June-29-2020

Browse Popular Code Answers by Language