Re: Issue with the cache

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Feb 14 2005 - 23:27:50 EST

  • Next message: Koen Segers: "unittesting"

    On Feb 14, 2005, at 10:45 PM, Joshua Pyle wrote:
    > I'm running into an interesting problem...
    >
    > 1. I run a query in Cayenne
    > 2. Outside of chayenne I update a field and commit to the DB
    > 3. I re-run the test at 1 and the field has not changed.
    >
    > I'm using Oracle 9 DB and jdbc drivers
    > I have turned off shared cache
    > I'm running from within a TimerTask that uses a thread bound
    > datacontext

    > I call the following before re-running the query ...
    > dbContext.invalidateObjects(
    > dbContext.getObjectStore().getObjects() );

    This is not needed if you want to refresh *root* objects of this query.
    To refresh objects *related* to the root objects you can set query
    prefetching. Also if you use a query stored in the DataMap, make sure
    "Refresh Results" checkbox is checked, and of course "No Result
    Caching" is selected.

    BTW, instead of invalidating *all* objects you can just throw away a
    given DataContext instance and create a new one. This is an equivalent
    operation, but looks much cleaner.

    > This is a bit frustrating because it seems to only hold onto varchar
    > fields, when I change a DATE field the change of the DATE field is
    > noticed but not the varchar field changes.

    This doesn't sound right. As far as caching is concerned Cayenne
    doesn't care about attribute types. There has to be something else at
    play. Can you create a test case demonstrating it?

    Andrus



    This archive was generated by hypermail 2.0.0 : Mon Feb 14 2005 - 23:27:56 EST