cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrey Razumovsky <>
Subject Re: DataContext cache WICKET
Date Mon, 07 Sep 2009 15:40:30 GMT
Hi Arnaud,

I haven't worked with Wicket, but...

1. If MyFacade is a singleton, createDataContext() is the correct way to
create a context. getThreadDataContext is used when a context is bound to
every thread, e.g. if you want to have a separate context for every user's
session. This is likely your case. To bind a context to every session, use
something like WebApplicationContextFilter (works only if you have one
domain, you need something more complicated otherwise)

2. If you bind context to a session, as described in #1, you won't have SQL
request at every refresh.

2009/9/7 Arnaud Garcia <>

> Hi list,
> I am using cayenne and wicket, and I found no example to integrate
> both framework....
> well, just a question of design for using the datacontext...
> Is it ok to use the datacontext in a singleton like this for a webapp
>  private MyFacade() {
>        ctxt = DataContext.createDataContext("DOMAIN1");
>    }
> => I ask this question since I saw on the documentation for webapp to
> use a getThreadDataContext ??
> 2/ About cache strategy...
> I have a big request on oracle, so I decided to use the
> QueryCacheStrategy.LOCAL_CACHE, but each time I refresh the webpage
> the request it always done...
> Is it because I didn't use correctly my datacontext ? do I have to
> create a new one each time using createDataContext ?
> thanks for help
> arnaud


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message