Query By example and boolean field

1.5k views Asked by At

In class Users, I have a field id, firstname, lastname, username, password, enabled.

Enabled field is boolean

When i use do this query by example with spring

Users users = new Users();
users.setId(12);
Example<Users> example = Example.of(users);
Page<Users> pageUsers = userRepository.findAll(example, page);

In the generated query, i see in the where condition, it search on id field and enabled

why it's search on enabled?

1

There are 1 answers

1
Geo On BEST ANSWER

You are using "boolean" primitive type, so your "Example" object has implicitly the "false" value.. you can use "Boolean" type to fix it