/** * If we created a transaction commit it. We have successfully processed all * the rows. */ protected void commitTransactionIfCreated() { if (createdTransaction) { transaction.commit(); logger.info("Committed transaction"); } }
/** * Commit the current transaction. */ @Override public void commitTransaction() { currentTransaction().commit(); }
/** * If we created a transaction commit it. We have successfully processed all * the rows. */ protected void commitTransactionIfCreated() { if (createdTransaction) { transaction.commit(); logger.info("Committed transaction"); } }
/** * Commit the current transaction. */ @Override public void commitTransaction() { currentTransaction().commit(); }
private synchronized void loadAll() { log.info("loading test data ----------------------------------------------"); runOnce = true; if (Country.find.query().findCount() > 0) { return; } try (Transaction transaction = Ebean.beginTransaction()) { try { deleteAll(); insertReference(); insertTestCustAndOrders(); transaction.commit(); } catch (Throwable e) { e.printStackTrace(); log.error("Error seeding", e); } } }
.findEach(bean -> resources.add(new MigrationResource(bean))); transaction.commit(); } catch (Exception e) { transaction.rollback();
/** * <p>executeTx.</p> * * @param c a {@link ameba.db.ebean.support.ModelResourceStructure.TxCallable} object. * @param errorHandler a {@link ameba.db.ebean.support.ModelResourceStructure.TxCallable} object. * @param <O> a O object. * @return a O object. * @throws java.lang.Exception if any. */ @SuppressWarnings("unchecked") protected <O> O executeTx(final TxCallable<O> c, final TxCallable<O> errorHandler) throws Exception { Transaction transaction = beginTransaction(); configureTransDefault(transaction); return processTransactionError(transaction, t -> { Object o = null; try { o = c.call(t); t.commit(); } catch (Throwable e) { t.rollback(e); throw e; } finally { t.end(); } return (O) o; }, errorHandler); }
/** * <p>executeTx.</p> * * @param r a {@link ameba.db.ebean.support.ModelResourceStructure.TxRunnable} object. * @param errorHandler error handler * @throws java.lang.Exception if any. */ protected void executeTx(final TxRunnable r, final TxRunnable errorHandler) throws Exception { Transaction transaction = beginTransaction(); configureTransDefault(transaction); processTransactionError(transaction, t -> { try { r.run(t); t.commit(); } catch (Throwable e) { t.rollback(e); throw e; } finally { t.end(); } return null; }, errorHandler != null ? (TxCallable) t -> { errorHandler.run(t); return null; } : null); }