You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Arnaud Garcia <ar...@imagemed-87.com> on 2009/09/07 17:18:13 UTC

DataContext cache WICKET

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

Re: DataContext cache WICKET

Posted by Reinout van Schouwen <re...@gmail.com>.
Hi Arnaud,

Op dinsdag 08-09-2009 om 09:31 uur [tijdzone +0200], schreef Arnaud
Garcia:

> many thanks .. I start with cayenne and wicket... so it is a bit hard to start..

Take a look at Databinder (www.databinder.net) - it provides a glue
layer between Wicket and Cayenne. It's not without its own problems, for
instance the latest stable release only supports Wicket 1.3.x and
Cayenne 2.0.4, but it could help you get started.

regards,

-- 
Reinout van Schouwen


Re: DataContext cache WICKET

Posted by Andrey Razumovsky <ra...@gmail.com>.
Hi Arnaud,

Have a look at recent discussion:
http://cayenne.markmail.org/message/3zcm4dw2ttbfjqwq?q=list:org.apache.cayenne.user&page=6#query:list%3Aorg.apache.cayenne.user+page:6+mid:3zcm4dw2ttbfjqwq+state:results

2009/9/8 Arnaud Garcia <ar...@imagemed-87.com>

> Thank you Andrey,
>
> 1/ hmmm, so that means that when I use in a webapp a Datacontext like:
> ctxt = DataContext.createDataContext()
>
> The DataContext is destroy at the end of the request ? this is why I
> do not my cache working ....
>
>
> 2/ To bind the DataContext to the user session I need to use the
> filter WebApplicationContextFilter as is it mentionned in the doc...
> But, as you guess I have more than one domain ;-), can you give some
> tips to do it ?
>
>
> many thanks .. I start with cayenne and wicket... so it is a bit hard to
> start..
>
> Arnaud
>
>
>
> 2009/9/7 Andrey Razumovsky <ra...@gmail.com>:
> > 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 <ar...@imagemed-87.com>
> >
> >> 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
> >>
> >
> >
> >
> > --
> > Andrey
> >
>



-- 
Andrey

Re: DataContext cache WICKET

Posted by Arnaud Garcia <ar...@imagemed-87.com>.
Thank you Andrey,

1/ hmmm, so that means that when I use in a webapp a Datacontext like:
ctxt = DataContext.createDataContext()

The DataContext is destroy at the end of the request ? this is why I
do not my cache working ....


2/ To bind the DataContext to the user session I need to use the
filter WebApplicationContextFilter as is it mentionned in the doc...
But, as you guess I have more than one domain ;-), can you give some
tips to do it ?


many thanks .. I start with cayenne and wicket... so it is a bit hard to start..

Arnaud



2009/9/7 Andrey Razumovsky <ra...@gmail.com>:
> 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 <ar...@imagemed-87.com>
>
>> 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
>>
>
>
>
> --
> Andrey
>

Re: DataContext cache WICKET

Posted by Andrey Razumovsky <ra...@gmail.com>.
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 <ar...@imagemed-87.com>

> 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
>



-- 
Andrey