Example #1
0
 private void commitTransaction(Session session, UnitOfWork uow) {
   if (uow.transactional()) {
     Transaction txn = session.getTransaction();
     if (txn != null && txn.isActive()) {
       txn.commit();
     }
   }
 }
Example #2
0
 private void configureSession(Session session, UnitOfWork uow) {
   session.setDefaultReadOnly(uow.readOnly());
   session.setCacheMode(uow.cacheMode());
   session.setFlushMode(uow.flushMode());
 }
Example #3
0
 private void beginTransaction(Session session, UnitOfWork uow) {
   if (uow.transactional()) {
     session.beginTransaction();
   }
 }