Re: toArray returns cached resultset

From: Mark Santos (zerofunk0..mail.com)
Date: Fri Sep 09 2005 - 01:04:46 EDT

  • Next message: Gili: ""is null" qualifier not working in modeler"

    Alright! It worked I used the context.invalidateObject(e) method to refresh
    it,
    thanks andrus!
     And yes the query is in the ... section hehe, thanks again.

     On 9/8/05, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >
    > Hi Mark,
    >
    > > Does cayenne cache the data in the context?
    >
    > Sure, that's the point of DataContext.
    >
    > > Is there a way to refresh it?
    >
    > Sure. There is a few ways... One is invalidate object "e" via
    > DataContext.invalidateObjects(..). Another is to use a prefetch in
    > the query that fetched "e" (I assume this is done somewhere in the
    > "..." section? :-)). That would refresh a relationship as well as the
    > object itself:
    >
    > SelectQuery query = ...
    > query.addPrefetch("employeeleavecounterArray");
    >
    > Andrus
    >
    > On Sep 8, 2005, at 11:33 PM, Mark Santos wrote:
    >
    > > Hello
    > >
    > > I used the toArray method , but then i found out that it returned
    > > previous resultset from the database (mysql 5),
    > > but when i try to restart the tomcat server the resultset is correct.
    > > Does cayenne cache the data in the context? Is there a way to
    > > refresh it?
    > >
    > >
    > > my code
    > >
    > > DataContext context = BasicServletConfiguration.getDefaultContext
    > > (session);
    > > ...
    > > ...
    > > ..
    > > List leavelist = e.getEmployeeleavecounterArray()
    > >
    > > - Mark Glen Santos
    >
    >



    This archive was generated by hypermail 2.0.0 : Fri Sep 09 2005 - 01:04:48 EDT