0
votes

I have a simple Boolean field in a pojo which I am storing in a gemfire region. The pojo also includes other fields with different data types (such as String, Long, Short, Date, etc). I have written a region query for each field and they return just fine all except the Boolean field. Example stub from my entity:

@Region("poc")
public class POCEntity {

    @Id
    @javax.persistence.Id
    private String id;
    private Boolean active;
    private String internalUsername;
    private Long dob;
    private Date createDate, updateDate;
        ...

And here is the repository stub:

//@Query("SELECT * FROM /poc p where p.active = false")
List<WellnessOptInEntity> findByActiveIsFalse();

I have tried every possible variation (with the manual query and with query generation) that I can find but querying the boolean field with PDX NOT configured always results in this exception:

java.lang.IllegalArgumentException: Unsupported operator TRUE! at org.springframework.data.gemfire.repository.query.Predicates$AtomicPredicate.getOperator(Predicates.java:174) at org.springframework.data.gemfire.repository.query.Predicates$AtomicPredicate.toClause(Predicates.java:137) at org.springframework.data.gemfire.repository.query.Predicates$AtomicPredicate.toString(Predicates.java:126) at org.springframework.data.gemfire.repository.query.Predicates.toString(Predicates.java:90) at org.springframework.data.gemfire.repository.query.QueryBuilder.create(QueryBuilder.java:44)

If I enable PDX, the query for the boolean field works fine. If PDX is not enabled (unit testing with a bootstrapped gemfire server for example), then the boolean query does not work.

Has anyone run into anything like this? I'm using gemfire 7.0.1 and spring-data-gemfire 1.3.3. I'm thinking this might be a bug in spring-data-gemfire but wanted to put this out there just to be sure.

1
Just to add a little more information in working with hubbardr on this the following specifically appears to be the issue. In org.springframework.data.gemfire.repository.query.Predicates there is a private method getOperator that takes a parameter type: org.springframework.data.repository.query.parser.Part.Type. This type comes in incorrectly. There is a public static method on the class fromProperty that gets a parameter ActiveIsFalse passed in and it sets the type to FALSE so we get a Type of "active FALSE" which isn't valid for the switch statement in getOperatorfpmoles

1 Answers

1
votes

It looks like it is an actual defect. We have logged the details (along with a sample project simulating the defect) here:

https://jira.springsource.org/browse/SGF-247