Depending on the scope of your BO object you should pick one or the other. If the scope is singleton, use the Provider (because the EntityManager has a smaller scope). If it is no-scope or the same scope as EM (say, request-scoped) then you can skip the provider. The difference is there because you don't want to hold on to a stale EM in a new call, even though your GenericBO never becomes stale itself.
Dhanji. On Sun, Aug 2, 2009 at 10:03 AM, ale <[email protected]> wrote: > > what is the difference between (using warp-persist): > > @Inject Provider<EntityManger> em; > > and > > @Inject EntityManager em; > > ??? > > > public abstract class GenericBO<T> { > protected final Provider<EntityManager> em; > > public GenericBO(Provider<EntityManager> em) { > this.em = em; > } > > } > public class CustomerBOImpl extends GenericBO<Cliente> implements > CustomerBO { > @Inject > public CustomerBOImpl(final Provider<EntityManager> em) { > super(em); > } > } > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-guice?hl=en -~----------~----~----~----~------~----~------~--~---
