Depends on whether or not you have request-specific state in each Dao. If not, then make them singletons. But remember that singletons MUST be threadsafe and MUST be concurrent. This is not the same thing as making all methods synchronized either.
Dhanji. On Wed, Oct 8, 2008 at 6:45 PM, jordi <[EMAIL PROTECTED]> wrote: > hey there! > > i'm an avid reader of this group, even i don't have much to say. my question > is "Should i use @Singleton in my Services and DAO's?" > > let me put you in context: i'm talking about a webapp running on Struts 2 + > Hibernate, Guice injecting everything everywhere. To simplify, every Action > call it's Service<T>, who has a DAO<T> to access database and retrieve that > type. That question arise from the easiness of making Singletons, so should > i do it? or better each request has it's own instantiated Service? > > thanks > > jordi > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
