Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-7764

Query 'not().having().contains()' gives unexpected result

    XMLWordPrintable

Details

    • Bug
    • Resolution: Obsolete
    • Major
    • None
    • 9.0.0.Final
    • Remote Querying
    • None

    Description

      Given following domain object

      @ProtoMessage
      @ProtoDoc("@Indexed")
      @EqualsAndHashCode(of = {"applicationCode", "applicationUserId"})
      public class ApplicationUser {
      
          private String applicationCode;
          private String applicationUserId;
          private Set<String> optoutCategories;
          private Set<Device> devices;
      
          //setter ommited
      
          @ProtoField(number = 1)
          public String getApplicationCode() {
              return applicationCode;
          }
      
          @ProtoField(number = 2)
          public String getApplicationUserId() {
              return applicationUserId;
          }
      
          @ProtoField(number = 3, collectionImplementation = HashSet.class)
          public Set<String> getOptoutCategories() {
              return optoutCategories;
          }
      
          @ProtoField(number = 4, collectionImplementation = HashSet.class)
          public Set<Device> getDevices() {
              return devices;
          }
      

      and following request embedded in a Spring repository:

      	public List<ApplicationUser> test() {
      		QueryFactory qf = getQueryFactory();
      		return qf.from(ApplicationUser.class)
      				.not().having("optoutCategories").contains("CAT2")
      				.and().having("applicationCode").eq("My_App_Yaya")
      				.toBuilder()
      				.build()
      				.list();
      	}
      

      and suppose the following json representation:

      [
          {
              "applicationCode": "My_App_Yaya",
              "applicationUserId": "123",
              "optoutCategories": [
                  "CAT3",
                  "CAT2",
                  "CAT1"
              ],
              "uniqueKey": "My_App_Yaya_123"
          }
      ]
      

      the query returns the ApplicationUser with json representation above, but should not as it precisely contains the optoutCategories we want to exclude.

      Attachments

        Activity

          People

            Unassigned Unassigned
            kevint_jira Kevin Tabary (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: