This library provides an abstraction of the entity manager and can be used to make instances managed and persistent.
These instructions will get you an overview on how to implement and use the cdi-persistence library. See further down for installing or deployment notes.
- Add the following dependencies to your project:
<dependency>
<groupId>ch.dvbern.oss.cdipersistence</groupId>
<artifactId>cdi-persistence-api</artifactId>
<version>{NEWEST_VERSION}</version>
</dependency>
<dependency>
<groupId>ch.dvbern.oss.cdipersistence</groupId>
<artifactId>cdi-persistence-test</artifactId>
<version>{NEWEST_VERSION}</version>
<scope>test</scope>
</dependency>
-
Write your PersistenceService, implementing the Interface Persistence
-
The persistence.xml found in the test-sources of the cdi-persistence-test-Module must be copied to the test-sources of your project as it references the (project specific) orm.xml (Adapt path if necessary)
-
Do not change the attribute "javax.persistence.jdbc.url" as it es referenced by the ch.dvbern.lib.inmemorypersistence.TestPersistenceManager.
-
Inject Persistence in your Tests: Your entities will be saved in a in-memory HSQLDB that will be cleared after each test.
- Maven - Dependency Management
Please read Contributing.md for the process for submitting pull requests to us.
One healthy social atmospehere is very important to us, wherefore we rate our Code of Conduct high. For details check the file CodeOfConduct.md
- DV Bern AG - Initial work - dvbern
See also the list of contributors who participated in this project.
This project is licensed under the Apache 2.0 License - see the License.md file for details.