Description
Geert Graat opened DATACMNS-1525 and commented
I am using QueryDSL web support and currently customizing it as per the documentation. I run into a problem with properties of type Map. Below is a snippet from my generated QITask class:
public final MapPath<String, String, StringPath> customFields = this.<String, String, StringPath>createMap("customFields", String.class, String.class, StringPath.class);
When I want to customize this property, I use the following
bindings.bind(task.customFields).first((path, values) -> ...
**
The problem is that because task.customFields is defined as a MapPath
, the values parameter is inferred to be a Map
. But when I run this, it always contains a List
.
When I debugged the QuerydslPredicateBuilder.getPredicate(..)
method, and the convertToPropertyPathSpecificType(..)
method was called, I found that there is no Converter available in the default ConversionService
in Spring to convert from String
(which the query argument always is) and Map
. Therefore the query arguments are simply returned in List.
As a workaround, I registered my own Converter that splits the query argument string on a specific character and creates a Map
with the first part as key and the second part as value. So with this, I can execute queries like:
http://...query?customFields=key:value
Affects: 2.1.6 (Lovelace SR6)