public void doCommit(Session session, RDFBeanTransaction txn) { RuntimeException commitException = null; try { session.flush(); txn.commit(); } catch (RuntimeException re) { doRollback(txn); commitException = re; } if (commitException != null) { throw commitException; } }
private void doCommit(Session session, RDFBeanTransaction txn) throws Exception { Exception commitException = null; try { session.flush(); txn.commit(); } catch (RuntimeException re) { doRollback(txn); commitException = re; } if (commitException != null) { throw commitException; } }
public SeedEntityImpl( Configuration configuration, SessionFactory sessionFactory, List<Object> entities) throws IOException { this.persisted = new HashMap<Object, Object>(entities.size()); Session session = sessionFactory.openSession(); RDFBeanTransaction tx = session.beginTransaction(); try { for (Object entity : entities) { replaceReferences(configuration, entity); Object original = session.getByExample(entity); if (original == null) { session.save(entity); } else { persisted.put(entity, original); } } tx.commit(); } catch (Exception e) { logger.error(e.getMessage(), e); tx.rollback(); } finally { session.close(); } }
@Override public void commit() { if (rollbackOnly) { throw new RepositoryException("Transaction is rollBackOnly"); } try { prepare(); } catch (RuntimeException e) { rollback(); throw new RepositoryException(e); } try { for (RDFBeanTransaction tx : transactions) { tx.commit(); } } finally { connection.cleanUpAfterCommit(); } }
@Override public <RT> RT execute(RDFConnectionCallback<RT> operation) { RDFConnection connection = openConnection(); try { RDFBeanTransaction tx = connection.beginTransaction(false, RDFBeanTransaction.TIMEOUT, RDFBeanTransaction.ISOLATION); try { RT retVal = operation.doInConnection(connection); tx.commit(); return retVal; } catch (IOException io) { tx.rollback(); throw new RepositoryException(io); } } finally { connection.close(); } }
@Override public <RT> RT execute(RDFConnectionCallback<RT> operation) { RDFConnection connection = openConnection(); try{ RDFBeanTransaction tx = connection.beginTransaction(false, RDFBeanTransaction.TIMEOUT, RDFBeanTransaction.ISOLATION); try{ RT retVal = operation.doInConnection(connection); tx.commit(); return retVal; }catch(IOException io){ tx.rollback(); throw new RepositoryException(io); } }finally{ connection.close(); } }
@Override public <RT> RT execute(RDFConnectionCallback<RT> operation) { RDFConnection connection = openConnection(); try { RDFBeanTransaction tx = connection.beginTransaction(false, RDFBeanTransaction.TIMEOUT, RDFBeanTransaction.ISOLATION); try { RT retVal = operation.doInConnection(connection); tx.commit(); return retVal; } catch (IOException io) { tx.rollback(); throw new RepositoryException(io); } } finally { connection.close(); } }
tx.commit(); } catch (RuntimeException oe) { throw new TransactionSystemException("error committing transaction", oe);