Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Intro page provides an overview, the setup of this module and describes the motivation for the features described below. This page explains the most important APIs and mechanisms of the JPA module provided by CODI. Please note that this page doesn't show all possibilities. If you have any question, please contact the community!

Tip
titleUpdate

This module is completely independent of the rest and already moved to Apache DeltaSpike (including several improvements like easier handling/usage of qualifiers, optional JTA support,...) .

Using one (default) Entity Manager

...

This approach just works if it doesn't come to serialization of this wrapper e.g. in case of session-replication.
If those beans get serialized, you have to overcome this restriction by storing the persistence-unit-name and recreate the EntityManager via Persistence.createEntityManagerFactory(this.persistenceUnitName).createEntityManager(); btw. sync it with the database before closing it on serialization. Furthermore, you have to intercept some methods of the EntityManager to merge detached entities automatically if those entities get serialized as well. However, as mentioned before we don't recommend such an approach.

JTA

CODI itself doesn't support it, but JTA support is available in Apache DeltaSpike.
Currently there is no support for it, however, you can use https://github.com/openknowledge/openknowledge-cdi-extensions in combination with MyFaces CODI for using JTA (if it works in combination with the application server of your choice).

...