p.s.: it does work like this: binder.bind(DomainPropertyService.class).scope("singleton"); BUT it says: The default service scope is "singleton" in the documentation....
-------- Original-Nachricht -------- > Datum: Wed, 04 Feb 2009 22:32:52 +0100 > Von: superoverdr...@gmx.de > An: users@tapestry.apache.org > Betreff: Singleton Service behaves like a Per-Thread service > Hello everyone! > > I am a bit confused. I thought the default service binding is a singleton? > > But why do I see a database query every time I load the same page? > > public class DomainPropertyService { > > private Session session; > > private List<Domain> domains = null; > > > public DomainPropertyService(Session session){ > this.session=session; > } > > > public String getString(String key){ > > if (domains==null){ > domains = session.createCriteria(Domain.class).list(); > } > > if (domains!=null){ > return "queries the database"; > } > else { > return "read from cache"; > } > > } > } > > > public static void bind(ServiceBinder binder) > { > > binder.bind(DomainPropertyService.class); > > } > > Thanks! > > Toby > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org