When the entity classes were first created they were modeled in JPA to match database field names. For our rest endpoints we used JsonProperty to let Jackson auto map names the client would expect they are kabob case. However we are now implementing search functionality and are building it using QueryDSL. It works and works well as long as we use the internal field names.
What we are looking to do though is accept querystrings with the JsonProperty Name.
Like: campaign-grouping-code=123 vs groupingCode=123
I am assuming it would probably have to be done in the Q Classes that are generated but can't find much documentation on them.
@Column(name = "GROUPING_CODE")
private String groupingCode;
@JsonProperty("campaign-grouping-code")
@NotBlank(message = "1", groups = CampaignFieldCheck.class)
@Size(max = 40, message = "100", groups = CampaignFieldCheck.class)
public String getGroupingCode() {
return groupingCode;
}
public void setGroupingCode(String groupingCode) {
this.groupingCode = groupingCode;
}
So there isnt a way to get the jsonproperty names to work. There is a workaround aliasing.. In this link you can find the black list and white list settings. Aliases are automatically white listed. but the aliases can be mapped via whatever text string makes sense to the field names.
https://gt-tech.bitbucket.io/spring-data-querydsl-value-operators/README.html