2016/02/07 - Apache Onami has been retired.

For more information, please explore the Attic.

Welcome to Onami-Persist!

Apache Onami Persistence is a Google Guice extension for JPA with support of container managed persistence units and transactions..

Before starting

Onami-Persist is available on the Maven Central repo, you just need to add the dependency below in your pom.xml file:

<dependencies>
  ...
  <dependency>
    <groupId>org.apache.onami</groupId>
    <artifactId>org.apache.onami.persist</artifactId>
    <version>1.0.1</version>
  </dependency>
  ...
</dependencies>

Why Onami-Persist

The official guice extension guice-persist allows to configure and inject a persistence unit into your classes. Guice-persist assumes that only one persistence unit is used in an application and that this persistence unit is application managed. Onami-Persist overcomes this shortcoming.

It supports:

  • multiple persistence units
  • application manged and container managed persistence units
  • resource local and JTA transactions.

Overview

Here you find a sample code of how a DAO or service may look if it uses guice-jpa

If you have used guice-persist before you may be interested in the differences between guice-jpa and guice-persist.

The most difficult part to get right is the configuration and setup of the persistence unit. Some examples are provided: