HHH-11059 : Improve documentation for JTA configuration in user guide

(cherry picked from commit b3d2c0fc90)
This commit is contained in:
Gail Badner 2016-08-22 19:11:45 -07:00
parent 1faeb54a3d
commit f60cb843eb
2 changed files with 25 additions and 2 deletions

View File

@ -430,7 +430,21 @@ Can be
* `TransactionCoordinatorBuilder` instance
* `TransactionCoordinatorBuilder` implementation `Class` reference
* `TransactionCoordinatorBuilder` implementation class name (fully-qualified name) or short-name
* `TransactionCoordinatorBuilder` implementation class name (fully-qualified name) or short name
The following short names are defined for this setting:
`jdbc`:: Manages transactions via calls to `java.sql.Connection` (default for non-JPA applications)
`jta`:: Manages transactions via JTA. See <<chapters/bootstrap/Bootstrap.adoc#bootstrap-jpa-compliant,Java EE bootstrapping>>
If a JPA application does not provide a setting for `hibernate.transaction.coordinator_class`, Hibernate will
automatically build the proper transaction coordinator based on the transaction type for the persistence unit.
If a non-JPA application does not provide a setting for `hibernate.transaction.coordinator_class`, Hibernate
will use `jdbc` as the default. This default will cause problems if the application actually uses JTA-based transactions.
A non-JPA application that uses JTA-based transactions should explicitly set `hibernate.transaction.coordinator_class=jta`
or provide a custom `org.hibernate.resource.transaction.TransactionCoordinatorBuilder` that builds a
`org.hibernate.resource.transaction.TransactionCoordinator` that properly coordinates with JTA-based transactions.
|`hibernate.jta.track_by_thread` | `true` (default value) or `false` |

View File

@ -24,9 +24,18 @@ Transaction handling per `Session` is handled by the `org.hibernate.resource.tra
`TransactionCoordinatorBuilder` represents a strategy for dealing with transactions whereas TransactionCoordinator represents one instance of that strategy related to a Session.
Which `TransactionCoordinatorBuilder` implementation to use is defined by the `hibernate.transaction.coordinator_class` setting.
`jdbc` (the default):: Manages transactions via calls to `java.sql.Connection`
`jdbc` (the default for non-JPA applications):: Manages transactions via calls to `java.sql.Connection`
`jta`:: Manages transactions via JTA. See <<chapters/bootstrap/Bootstrap.adoc#bootstrap-jpa-compliant,Java EE bootstrapping>>
If a JPA application does not provide a setting for `hibernate.transaction.coordinator_class`, Hibernate will
automatically build the proper transaction coordinator based on the transaction type for the persistence unit.
If a non-JPA application does not provide a setting for `hibernate.transaction.coordinator_class`, Hibernate
will use `jdbc` as the default. This default will cause problems if the application actually uses JTA-based transactions.
A non-JPA application that uses JTA-based transactions should explicitly set `hibernate.transaction.coordinator_class=jta`
or provide a custom `org.hibernate.resource.transaction.TransactionCoordinatorBuilder` that builds a
`org.hibernate.resource.transaction.TransactionCoordinator` that properly coordinates with JTA-based transactions.
[NOTE]
====
For details on implementing a custom `TransactionCoordinatorBuilder`, or simply better understanding how it works, see the Integrations Guide.