Spring data QueryDSL using key, value pair of map collection

244 views
Skip to first unread message

peter lee

unread,
May 20, 2017, 7:59:59 AM5/20/17
to Querydsl

My domain like these:

@Document(collection = "vip")
public class Vip implements Serializable {

private static final long serialVersionUID = 1L;

@Id
private String id;

@Field("package_type")
private String packageType;

@Field("packageServices")
private List<Map<String,Object>> packageServices;...
}

How can I customize the bindings for keys of map in packageServices collection when querying in url? E.g: I have a key name serviceType, how can I bind it in customize method?

@Override
default public void customize(QuerydslBindings bindings, QVip root) {

//?bindings.bind (root.packageServices.any ().)

 bindings.bind(String.class).first((StringPath path, String value) ->
 path.containsIgnoreCase(value));
//...
}

I have seen Spring Data JPA with Querydsl -- filter by value inside array from URL and https://jira.spring.io/browse/DATACMNS-883. And I believe spring data jpa should support this kinds of query, however I'm a newcomer to QueryDSL and stuck in the problem for a while.
Anyone can help me? Thanks in advance. BTW: I use querydsl version 4.1.0

Reply all
Reply to author
Forward
0 new messages