Hy Toby,
you might be fooled by your own code.
if (domains!=null){
return "queries the database";
Should be
if (domains==null){
return "queries the database";
Regards, nillehammer

--
http://www.winfonet.eu

superoverdr...@gmx.de schrieb:
> 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
> 
> 

-- 
http://www.winfonet.eu

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to