Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-1013

the RefreshQuery does not refresh LOCAL_CACHE queries

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0
    • 3.0
    • Core Library
    • None
    • ROP + derby

    Description

      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.

      Attachments

        Activity

          People

            andrus Andrus Adamchik
            marcin Marcin Skladaniec
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: