/** * Returns the current transaction or null if there is no current transaction * in scope. */ public static Transaction currentTransaction() { return serverMgr.getDefaultServer().currentTransaction(); }
/** * Mark the current transaction as rollback only. */ public static void setRollbackOnly() { serverMgr.getDefaultServer().currentTransaction().setRollbackOnly(); }
/** * Return the current transaction. */ public Transaction currentTransaction() { return db().currentTransaction(); }
/** * Return the current transaction. */ public Transaction currentTransaction() { return db().currentTransaction(); }
/** * Create a transaction if one is not already active and set its batch mode * and batch size. */ protected void initTransactionIfRequired() { transaction = server.currentTransaction(); if (transaction == null || !transaction.isActive()) { transaction = server.beginTransaction(); createdTransaction = true; if (persistBatchSize > 1) { logger.info("Creating transaction, batchSize[" + persistBatchSize + "]"); transaction.setBatchMode(true); transaction.setBatchSize(persistBatchSize); transaction.setBatchGetGeneratedKeys(false); } else { // explicitly turn off JDBC batching in case // is has been turned on globally transaction.setBatchMode(false); logger.info("Creating transaction with no JDBC batching"); } } }
/** * Returns the current transaction or null if there is no current transaction * in scope. */ public static Transaction currentTransaction() { return serverMgr.getDefaultServer().currentTransaction(); }
/** * Return the current transaction. */ public Transaction currentTransaction() { return db().currentTransaction(); }
/** * Mark the current transaction as rollback only. */ public static void setRollbackOnly() { serverMgr.getDefaultServer().currentTransaction().setRollbackOnly(); }
@Override protected void doRollbackTx(Object delegate, Throwable cause) { Transaction tx = ebean.currentTransaction(); if (null == tx) { return; } if (TxContext.readOnly()) { ebeanReadOnly.endTransaction(); } else { SpiEbeanServer server = (SpiEbeanServer) ebean; server.scopedTransactionExit(cause, Opcodes.ATHROW); } }
@Override protected void doEndTxIfActive(Object delegate) { Transaction tx = ebean.currentTransaction(); if (null == tx) { return; } if (TxContext.readOnly()) { ebeanReadOnly.endTransaction(); } else { SpiEbeanServer server = (SpiEbeanServer) ebean; server.scopedTransactionExit(null, 1); } }
/** * Create a transaction if one is not already active and set its batch mode * and batch size. */ protected void initTransactionIfRequired() { transaction = server.currentTransaction(); if (transaction == null || !transaction.isActive()) { transaction = server.beginTransaction(); createdTransaction = true; if (persistBatchSize > 1) { logger.info("Creating transaction, batchSize[" + persistBatchSize + "]"); transaction.setBatchMode(true); transaction.setBatchSize(persistBatchSize); transaction.setBatchGetGeneratedKeys(false); } else { // explicitly turn off JDBC batching in case // is has been turned on globally transaction.setBatchMode(false); logger.info("Creating transaction with no JDBC batching"); } } }
/** * {@inheritDoc} */ @Override public void update(boolean deleteMissingChildren) { Transaction t = server().currentTransaction(); t = t == null ? server().beginTransaction() : t; server().update(getModel(), t, deleteMissingChildren); }