Class ScopedTransaction

java.lang.Object
io.ebeaninternal.api.SpiTransactionProxy
io.ebeaninternal.api.ScopedTransaction
All Implemented Interfaces:
Transaction, SpiTransaction, AutoCloseable

public final class ScopedTransaction extends SpiTransactionProxy
Manage scoped (typically thread local) transactions.

These can be nested and internally they are pushed and popped from a stack.

  • Constructor Details

  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setNestedUseSavepoint

      public void setNestedUseSavepoint()
      Specified by:
      setNestedUseSavepoint in interface Transaction
      Overrides:
      setNestedUseSavepoint in class SpiTransactionProxy
    • isNestedUseSavepoint

      public boolean isNestedUseSavepoint()
      Description copied from interface: SpiTransaction
      Return true when nested transactions should create Savepoints.
      Specified by:
      isNestedUseSavepoint in interface SpiTransaction
      Overrides:
      isNestedUseSavepoint in class SpiTransactionProxy
    • push

      public void push(ScopeTrans scopeTrans)
      Push the scope transaction.
    • complete

      public void complete(Object returnOrThrowable, int opCode)
      Exiting an enhanced transactional method.
    • complete

      public void complete()
      Internal programmatic complete - finally block, try to commit.
    • end

      public void end() throws jakarta.persistence.PersistenceException
      Throws:
      jakarta.persistence.PersistenceException
    • close

      public void close()
    • commit

      public void commit()
    • rollbackAndContinue

      public void rollbackAndContinue()
    • rollback

      public void rollback() throws jakarta.persistence.PersistenceException
      Throws:
      jakarta.persistence.PersistenceException
    • rollback

      public void rollback(Throwable e) throws jakarta.persistence.PersistenceException
      Throws:
      jakarta.persistence.PersistenceException
    • setRollbackOnly

      public void setRollbackOnly()
    • current

      public SpiTransaction current()
      Return the current transaction.
    • caughtError

      public Error caughtError(Error e)
      Rollback for Error.
    • caughtThrowable

      public Exception caughtThrowable(Exception e)
      Maybe rollback based on TxScope rollback on settings.
    • putUserObject

      public void putUserObject(String name, Object value)
      New user objects are always written to the current ScopeTrans.
      Specified by:
      putUserObject in interface Transaction
      Overrides:
      putUserObject in class SpiTransactionProxy
    • getUserObject

      public Object getUserObject(String name)
      Returns the userObject in the stack, Herew we search the stack and return the first found userObject
      Specified by:
      getUserObject in interface Transaction
      Overrides:
      getUserObject in class SpiTransactionProxy