Class TransactionHelper


  • public final class TransactionHelper
    extends Object
    A helper to abstract away all the complexity of starting transactions in different environments (JTA/non-JTA in particular), while accepting some JTA-specific settings (transaction timeout) on a best-effort basis.
    • Constructor Detail

      • TransactionHelper

        public TransactionHelper​(org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory,
                                 Integer transactionTimeout)
    • Method Detail

      • inTransaction

        public void inTransaction​(org.hibernate.engine.spi.SharedSessionContractImplementor session,
                                  Runnable action)
      • inTransaction

        public <T> T inTransaction​(org.hibernate.engine.spi.SharedSessionContractImplementor session,
                                   Supplier<T> action)
      • begin

        public void begin​(org.hibernate.engine.spi.SharedSessionContractImplementor session)
      • commit

        public void commit​(org.hibernate.engine.spi.SharedSessionContractImplementor session)
      • rollbackSafely

        public void rollbackSafely​(org.hibernate.engine.spi.SharedSessionContractImplementor session,
                                   Throwable t)