Author: Not specified Language: java
Description: Not specified Timestamp: 2018-04-27 16:01:55 +0000
View raw paste Child paste by: Not specified Reply
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();
}
View raw paste Child paste by: Not specified Reply