Re: DataContext cache WICKET

From: Andrey Razumovsky (razumovsky.andre..mail.com)
Date: Tue Sep 08 2009 - 04:20:29 EDT

  • Next message: Michael Gentry: "Re: Cloning DataDomain"

    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 <arnau..magemed-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 <razumovsky.andre..mail.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 <arnau..magemed-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
    



    This archive was generated by hypermail 2.0.0 : Tue Sep 08 2009 - 04:21:40 EDT