[infinispan-issues] [JBoss JIRA] (ISPN-7764) Query 'not().having().contains()' gives unexpected result

Kevin Tabary (JIRA) issues at jboss.org
Tue Apr 25 06:13:00 EDT 2017


Kevin Tabary created ISPN-7764:
----------------------------------

             Summary: Query 'not().having().contains()' gives unexpected result
                 Key: ISPN-7764
                 URL: https://issues.jboss.org/browse/ISPN-7764
             Project: Infinispan
          Issue Type: Bug
          Components: Remote Querying
    Affects Versions: 9.0.0.Final
            Reporter: Kevin Tabary


Given following domain object
{code}
@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;
    }
{code}

and following request embedded in a Spring repository:
{code}
	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();
	}
{code}

and suppose the following json representation:
{code}
[
    {
        "applicationCode": "My_App_Yaya",
        "applicationUserId": "123",
        "optoutCategories": [
            "CAT3",
            "CAT2",
            "CAT1"
        ],
        "uniqueKey": "My_App_Yaya_123"
    }
]
{code}

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



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the infinispan-issues mailing list