I think you are on a wrong track. You only create one Injector instance for an application and you only start the persistence service once. What you have to do is: - Don't inject EntityManager into your DAO but inject Provider<EntiyManager>. The EntityManager is an object with a limited lifetime. It will become unusable once a unit of work has finished. Therefore you need to get an instance from the provider just when you need it. And you should not store the EntiyManager in a member variable of a class. - begin and end UnitOfWork if you don't use the PersistFilter in a ServletContainer. If your application runs in a servlet container I highly recommend you use the PersistFilter as described on the guice homepage to span a unit of work around a request. On 08/29/2012 06:04 PM, Arthur Gregório
wrote:
-- You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to google-guice@googlegroups.com. To unsubscribe from this group, send email to google-guice+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-guice?hl=en. |
- JSE architecture to inject DAO's members Arthur Gregório
- Re: JSE architecture to inject DAO's members Stephan Classen
- Re: JSE architecture to inject DAO's members Arthur Gregório
- Re: JSE architecture to inject DAO's members Stephan Classen
- Re: JSE architecture to inject DAO's mem... Stephan Classen
- Re: JSE architecture to inject DAO'... Arthur Gregório