Skip to content

guice jpa vs. guice persist

sclassen edited this page Jan 11, 2013 · 4 revisions

guice-jpa 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:

  • 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.
  • @Finder annotation is not yet supported
Clone this wiki locally