Re: toArray returns cached resultset

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Sep 08 2005 - 23:41:07 EDT

  • Next message: Gili: "Util.unwindException()"

    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 : Thu Sep 08 2005 - 23:41:09 EDT