Onami-Persist vs. Guice-Persist
Onami-Persist is inspired and based upon Guice-Persist. Most of the concepts and ideas have been adapted and/or reused;
- UnitOfWork as the life cycle manager for EntityManagers;
- PersistFilter for spanning a UnitOfWork around a request;
- PersistenceService for starting and stopping the entire persistence engine;
- @Transactional annotation on methods to span a transaction around the method.
The most notable changes to Guice-Persist:
- Integrated support for multiple persistence units, JTA and custom annotation;
- EntityManager cannot be injected. Instead an EntityManagerProvider has to be injected (details);
- @Transactional annotation allows to specify which persistence units are involved in the transaction;
- UnitOfWork has a new method isActive();
- Retrieving an EntityManager does not start a UnitOfWork. Instead it will throw an Exception if the UnitOfWork is not active;
- PersistenceService can be restarted after it has been stopped.