forked from google/guice
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separeted UnitOfWork and EntityManager
This modification continues work of Andreas Viedma (andresviedma:unitofwork-annotation). Current solution of the EntityManager doesn't robustly support use of Transaction scoped EntityManager.If EntityManager is injected or emProvider.get() is called outside of the Transactional annotation, then this will lead to never closed EntityManager. (Current solution would need boilerplate UnitOfWork.end() calls). This behaviour is also different than in Guice 2.0 with warp-persist, where Transaction scoped EntityManager works. With this commit UnitOfWork and EntityManager are separated. This means that getting of EntityManager doesn't start UnitOfWork. If EntityManager scope needs to be different than transaction, UnitOfWork has to be explicitly started.UnitOfWork can be started with annotation or explicitly calling begin(). Annotation supports nested UnitOfWorks. If begin is called directly from UnitOfWork then it requires direct call to end() to end UnitOfWork.End call will always end UnitOfWork. Resolves issues: google#739, google#947
- Loading branch information
Showing
12 changed files
with
516 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.