the default scope of a service is "singleton". i you want a new DAO on every request you can annotate you method with :
@Scope(IOCConstants.PERTHREAD_SCOPE) if you are using tapestry-hibernate you can have your session injected into a "singleton" scoped service and tapestry will take care of it. please see the documentation and search the mailinglist. there was a very good thread a week ago e.g. http://www.nabble.com/T5%3A-%27wrapping%27-hibernate-DAOs-as-services-tf4710067.html#a13466570 g, kris Andy Huhn <[EMAIL PROTECTED]> 07.11.2007 05:11 Bitte antworten an "Tapestry users" <users@tapestry.apache.org> An Tapestry users <users@tapestry.apache.org> Kopie Thema T5: Preparing a pristine object for re-use Hello, I have a DAO that I want to re-initialize every time it is injected (that is, the DAO has state that I want to reset to make it pristine). I thought I could do it in the constructor for the DAO, since I am defining the service as follows in my AppModule: public static AccountDAO buildAccountDAO( Session prmSn ) { return new AccountDAOImpl( prmSn ); } But it appears the constructor is only being executed the first time the DAO is injected, it is not being executed on subsequent injections. Am I missing something? Thanks, Andy --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]