Top Fields
org.hibernate.cfg

public Interface TransactionSettings

Known Direct Subinterfaces
org.hibernate.cfg.AvailableSettings
Imports
jakarta.persistence.spi.PersistenceUnitInfo

Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
public static final String
ALLOW_JTA_TRANSACTION_ACCESS

When enabled, allows access to the org.hibernate.Transaction even when using a JTA for transaction management.

public static final String
ALLOW_UPDATE_OUTSIDE_TRANSACTION

When enabled, allows update operations outside a transaction.

public static final String
AUTO_CLOSE_SESSION

When enabled, specifies that the org.hibernate.Session should be closed automatically at the end of each transaction.

public static final String
ENABLE_LAZY_LOAD_NO_TRANS

Allows a detached proxy or lazy collection to be fetched even when not associated with an open persistence context, by creating a temporary persistence context when the proxy or collection is accessed.

public static final String
FLUSH_BEFORE_COMPLETION

When enabled, specifies that automatic flushing should occur during the JTA jakarta.transaction.Synchronization#beforeCompletion() callback.

public static final String
public static final String
public static final String
JTA_PLATFORM

Specifies the org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform implementation to use for integrating with JTA, either:

  • an instance of JtaPlatform, or
  • the name of a class that implements JtaPlatform.
  • short name of a class (sans package name) that implements JtaPlatform.
public static final String
public static final String
JTA_TRACK_BY_THREAD

A transaction can be rolled back by another thread ("tracking by thread") -- not the original application.

public static final String
PREFER_USER_TRANSACTION

When enabled, specifies that the jakarta.transaction.UserTransaction should be used in preference to the jakarta.transaction.TransactionManager for JTA transaction management.

public static final String
TRANSACTION_COORDINATOR_STRATEGY

Specify the org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder implementation to use for creating instances of org.hibernate.resource.transaction.spi.TransactionCoordinator which the interface Hibernate uses to manage transactions.

Field Detail

ALLOW_JTA_TRANSACTION_ACCESSback to summary
public static final String ALLOW_JTA_TRANSACTION_ACCESS

When enabled, allows access to the org.hibernate.Transaction even when using a JTA for transaction management.

Values are true, which grants access, and false, which does not.

See Also
JpaComplianceSettings#JPA_TRANSACTION_COMPLIANCE
ALLOW_UPDATE_OUTSIDE_TRANSACTIONback to summary
public static final String ALLOW_UPDATE_OUTSIDE_TRANSACTION

When enabled, allows update operations outside a transaction.

Since version 5.2 Hibernate conforms with the JPA specification and disallows flushing any update outside a transaction.

Values are true, which allows flushing outside a transaction, and false, which does not.

The default behavior is to disallow update operations outside a transaction.

Since
5.2
See Also
org.hibernate.boot.SessionFactoryBuilder#allowOutOfTransactionUpdateOperations(boolean)
AUTO_CLOSE_SESSIONback to summary
public static final String AUTO_CLOSE_SESSION

When enabled, specifies that the org.hibernate.Session should be closed automatically at the end of each transaction.

See Also
org.hibernate.boot.SessionFactoryBuilder#applyAutoClosing(boolean)
ENABLE_LAZY_LOAD_NO_TRANSback to summary
public static final String ENABLE_LAZY_LOAD_NO_TRANS

Allows a detached proxy or lazy collection to be fetched even when not associated with an open persistence context, by creating a temporary persistence context when the proxy or collection is accessed. This behavior is not recommended, since it can easily break transaction isolation or lead to data aliasing; it is therefore disabled by default.

See Also
org.hibernate.boot.SessionFactoryBuilder#applyLazyInitializationOutsideTransaction(boolean)
FLUSH_BEFORE_COMPLETIONback to summary
public static final String FLUSH_BEFORE_COMPLETION

When enabled, specifies that automatic flushing should occur during the JTA jakarta.transaction.Synchronization#beforeCompletion() callback.

See Also
org.hibernate.boot.SessionFactoryBuilder#applyAutoFlushing(boolean)
JTA_CACHE_TMback to summary
public static final String JTA_CACHE_TM

When enabled, indicates that it is safe to cache jakarta.transaction.TransactionManager references in the org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform

Since
4.0
JTA_CACHE_UTback to summary
public static final String JTA_CACHE_UT

When enabled, indicates that it is safe to cache jakarta.transaction.UserTransaction references in the org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform

Since
4.0
JTA_PLATFORMback to summary
public static final String JTA_PLATFORM

Specifies the org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform implementation to use for integrating with JTA, either:

  • an instance of JtaPlatform, or
  • the name of a class that implements JtaPlatform.
  • short name of a class (sans package name) that implements JtaPlatform.
Since
4.0
See Also
JTA_PLATFORM_RESOLVER
JTA_PLATFORM_RESOLVERback to summary
public static final String JTA_PLATFORM_RESOLVER

Specifies a org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformResolver implementation that should be used to obtain an instance of org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform.

Since
4.3
JTA_TRACK_BY_THREADback to summary
public static final String JTA_TRACK_BY_THREAD

A transaction can be rolled back by another thread ("tracking by thread") -- not the original application. Examples of this include a JTA transaction timeout handled by a background reaper thread. The ability to handle this situation requires checking the Thread ID every time Session is called. This can certainly have performance considerations.

See Also
org.hibernate.boot.SessionFactoryBuilder#applyJtaTrackingByThread(boolean)
PREFER_USER_TRANSACTIONback to summary
public static final String PREFER_USER_TRANSACTION

When enabled, specifies that the jakarta.transaction.UserTransaction should be used in preference to the jakarta.transaction.TransactionManager for JTA transaction management.

By default, the TransactionManager is preferred.

Since
5.0
See Also
org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform#retrieveUserTransaction, org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform#retrieveTransactionManager, org.hibernate.boot.SessionFactoryBuilder#applyPreferUserTransactions(boolean)
TRANSACTION_COORDINATOR_STRATEGYback to summary
public static final String TRANSACTION_COORDINATOR_STRATEGY

Specify the org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder implementation to use for creating instances of org.hibernate.resource.transaction.spi.TransactionCoordinator which the interface Hibernate uses to manage transactions.

Accepts either:

  • an instance of TransactionCoordinatorBuilder,
  • a Class representing a class that implements TransactionCoordinatorBuilder,
  • the name of a class that implements TransactionCoordinatorBuilder,
  • jta or jdbc

Implementation Specification

With non Jakarta Persistence bootstrapping, Hibernate will use jdbc as the default which will cause problems if the application actually uses JTA-based transactions.

Since
5.0
See Also
JTA_PLATFORM