Clearing query cache on commit

From: Gili (cowwo..bs.darktech.org)
Date: Tue Sep 13 2005 - 15:51:18 EDT

  • Next message: Gili: "Re: Clearing query cache on commit"

    Hi,

            I need to clear the query cache on DataContext.commitChanges(). The
    only way I can see this working is if I invoke DataRowStore.clear() but
    as Mike mentioned to me offline this sounds like an overly aggressive
    approach.

            Is there a finer-grained method for clearing query cache for all queries?

            My use-case is:

    1) Database is empty
    2) ContentType.getCanonicalInstance() returns an empty set, so I commit
    a new object to the database
    3) DataContext.commitChanges()
    4) I invoke ContentType.getCanonicalInstance() again. This time it I
    expect it to return the instance I commited to the DB in step 3, but it
    returns the cached result (empty set).
    5) DataContext.commitChanges()
    6) Database complains of unique constraint violation

            Currently I invoke
    "context.invalidateObjects(context.getObjectStore().getObjects())" after
    each commitChanges(). I'd want to do something equivilent for the query
    cache.

    Thanks,
    Gili

    -- 
    http://www.desktopbeautifier.com/
    



    This archive was generated by hypermail 2.0.0 : Tue Sep 13 2005 - 15:51:17 EDT