Search by null from query string parameters

26 views
Skip to first unread message

Joshua Chan

unread,
Apr 20, 2016, 4:20:48 AM4/20/16
to Querydsl

I have a controller method for searching like so

@RequestMapping(method = RequestMethod.GET)
public Page<MyEntity> find(@QuerydslPredicate(root = MyEntity.class) Predicate predicate,
   
Pageable pageable) {
 
return this.myEntityRepository.findAll(predicate, pageable);
}

It works great. I can issue a GET request with various query string parameters, and it filters accordingly, but now I want to search by null. I tried doing something like /myentity?myParam1=&, but the predicate argument is always null.

How can I search where specific fields are null?

I also posted this on SO.

timowest

unread,
Apr 20, 2016, 1:38:05 PM4/20/16
to Querydsl
Hi.

This seems to be Spring Data related. Could you post this question on their support forum? I don't know how to fix it.

Timo
Reply all
Reply to author
Forward
0 new messages