Repository: deltaspike Updated Branches: refs/heads/master 8402766eb -> 44d188449
DELTASPIKE-956 Cleaned up some docs around transaction management and JPA module. Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/44d18844 Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/44d18844 Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/44d18844 Branch: refs/heads/master Commit: 44d188449a591223ffb8440b0a83227ec36dce2d Parents: 8402766 Author: John D. Ament <[email protected]> Authored: Sun Aug 16 21:04:22 2015 -0400 Committer: John D. Ament <[email protected]> Committed: Sun Aug 16 21:04:22 2015 -0400 ---------------------------------------------------------------------- documentation/src/main/asciidoc/jpa.adoc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/44d18844/documentation/src/main/asciidoc/jpa.adoc ---------------------------------------------------------------------- diff --git a/documentation/src/main/asciidoc/jpa.adoc b/documentation/src/main/asciidoc/jpa.adoc index e096ba4..d4835ff 100644 --- a/documentation/src/main/asciidoc/jpa.adoc +++ b/documentation/src/main/asciidoc/jpa.adoc @@ -32,7 +32,7 @@ Add the JPA module to the list of dependencies in the project `pom.xml` file usi ---- === 2. Enable the Transaction Interceptor -For CDI 1.0 (or DeltaSpike v1.1.0 and earlier together with CDI 1.1+), you must enable the transaction interceptor in the project `beans.xml` file: +If you are using CDI 1.0 or CDI 1.1+ with DeltaSpike v1.1.0 and earlier, you must enable the transaction interceptor in the project `beans.xml` file: [source,xml] ---- @@ -541,6 +541,11 @@ in the beans.xml which is called </beans> ---------------------------------------------------------------------------------------------------- +Alternatively, you may expect that your transactions are started at a higher level, e.g. you're exposing a REST API +and the endpoints themselves are either `@Transactional` or Stateless session beans, either with container managed +Transactions, you would use `org.apache.deltaspike.jpa.impl.transaction.ContainerManagedTransactionStrategy`. This +is the strategy to use if you are leveraging `@PersistenceContext` to inject your `EntityManager`. + If you have multiple persistence units and you have to use both transaction types or the settings for development have to be different than the production settings, you can use @@ -548,8 +553,8 @@ than the production settings, you can use instead. NOTE: In case of some versions of Weld (or OpenWebBeans in BDA mode), you have -to configure it as global-alternative instead of an `<alternatives>` in -beans.xml. That means you have to add, for example, +to configure it as a <<spi.adoc#GlobalAlternative,global alternative>> instead of an `alternative` in +`beans.xml`. That means you have to add, for example, `globalAlternatives.org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy =org.apache.deltaspike.jpa.impl.transaction.BeanManagedUserTransactionStrategy` -to `/META-INF/apache-deltaspike.properties` +to `/META-INF/apache-deltaspike.properties`.
