/** * Execute the query returning the resulting List. */ @Override public List<T> call() throws Exception { try { return server.findList(query, transaction); } finally { // cleanup the underlying connection transaction.end(); } }
/** * Execute the query returning the row count. */ @Override public Integer call() throws Exception { try { return server.findCountWithCopy(query, transaction); } finally { // cleanup the underlying connection transaction.end(); } }
/** * Execute the find Id's query returning the list of Id's. */ @Override public List<Object> call() throws Exception { // we have already made a copy of the query // this way the same query instance is available to the // QueryFutureIds (as so has access to the List before it is done) try { return server.findIdsWithCopy(query, transaction); } finally { transaction.end(); } }
Transaction transaction = transactionManager.getInScope(); if (transaction != null) { transaction.end();
/** * Execute the query returning the row count. */ @Override public Integer call() throws Exception { try { return server.findCountWithCopy(query, transaction); } finally { // cleanup the underlying connection transaction.end(); } }
/** * Execute the query returning the resulting List. */ @Override public List<T> call() throws Exception { try { return server.findList(query, transaction); } finally { // cleanup the underlying connection transaction.end(); } }
/** * Execute the find Id's query returning the list of Id's. */ @Override public List<Object> call() throws Exception { // we have already made a copy of the query // this way the same query instance is available to the // QueryFutureIds (as so has access to the List before it is done) try { return server.findIdsWithCopy(query, transaction); } finally { transaction.end(); } }
Transaction transaction = transactionManager.getInScope(); if (transaction != null) { transaction.end();
transaction.rollback(); } finally { transaction.end();
/** * <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); }