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

This commit is contained in:
Gail Badner 2016-08-22 19:11:45 -07:00
parent 68c62da29e
commit b3d2c0fc90
2 changed files with 25 additions and 2 deletions

View File

@ -431,7 +431,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

@ -25,9 +25,18 @@ which are built by the `org.hibernate.resource.transaction.spi.TransactionCoordi
`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.