Are you sure you're seeing a query or do you mean your code returns "queries 
the database" ?
That method will always return "queries the database".
I'm not sure what it's for but perhaps you would want to change it something 
like

> if (domains==null){
>       domains = session.createCriteria(Domain.class).list();
>       return "queries the database";  
> }
> else {
>       return "read from cache";
> }




On Wed, 04 Feb 2009 22:32:52 +0100, <superoverdr...@gmx.de> wrote:

> 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

Reply via email to