You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by "Andrus Adamchik (JIRA)" <de...@cayenne.apache.org> on 2008/03/29 18:52:39 UTC

[jira] Commented: (CAY-1013) the RefreshQuery does not refresh LOCAL_CACHE queries

    [ https://issues.apache.org/cayenne/browse/CAY-1013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12804#action_12804 ] 

Andrus Adamchik commented on CAY-1013:
--------------------------------------



> otherContext.performGenericQuery(new RefreshQuery(newArtist));

This is a noop... since this object was just inserted, it is not going to refresh any stale cached data...

> // otherContext.performGenericQuery(new RefreshQuery(new String[] {someKey})); //does not make any difference 

This is sort of the right way to do it, but it doesn't work, since it refreshes caches down the stack (this context and its parents)... It does not refresh the peer LOCAL_CACHE (otherContext vs. aContext). So a quick way to fix it would be to "aContext" for all RefreshQueries... This of course may not be ideal, especially if there is more than once context that needs to be refreshed.. Let me think about it some more


> the RefreshQuery does not refresh LOCAL_CACHE queries
> -----------------------------------------------------
>
>                 Key: CAY-1013
>                 URL: https://issues.apache.org/cayenne/browse/CAY-1013
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Cayenne Core Library
>    Affects Versions: 3.0
>         Environment: ROP + derby
>            Reporter: Marcin Skladaniec
>            Assignee: Andrus Adamchik
>
> During our testing we found out that the RefreshQuery does not work. The problem can be shown in the following code:
> SelectQuery sq = new SelectQuery(Artist.class, someExpression);
> sq.setCachePolicy(QueryMetadata.LOCAL_CACHE);
> sq.setPageSize(pageSize);
> // sq.setCacheGroups(new String[] { someKey }); //optional, does not change the result
> List<Artist> list1 = aContext.performQuery(sq);
> Artist newArtist = otherContext.newRecord(Artist.class);
> otherContext.commitChanges();
> otherContext.performGenericQuery(new RefreshQuery(newArtist));
> // otherContext.performGenericQuery(new RefreshQuery(new String[] {someKey})); //does not make any difference
> List<Artist> list2 = aContext.performQuery(sq);
> //the following line prints 'false'
> logger.info("cache refreshed = "+(list1.size() !=   list2.size()));
> I tried hard to write a test case in cayenne, but I had some problems first with compiling the tests, then with actual test class/method itself. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.