In my view I send async request to controller with Json Data as following:
{
"filters":{
"someField":"someValue",
"someField":"someValue",
"someField":null,
"someField":null,
}
}
But data can be different. And I have Order Entity that has same fields, so I can convert It from Json to POJO
After that using JPA I can do following:
Example<Order> orderExample = Example.of(orderFromJson);
orderRepository.findAll(orderExample);
But I use spring-data-jdbc which doesn't support it, What can replace it?
For cases like this where no direct support is offered, the correct approach is to get a JdbcTemplate
or NamedParameterJdbcTemplate
injected, and construct the required SQL from your filter information. You may make the method a custom repository method .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.