I have situation in which I have to compose a JPQL query in some method, then pass this query to spring data query method to be used as the query in @Query
annotation
@Query(value = ":DyanamicQuery")
List<PrizeInsuranceConfiguration> filterConfigurPrizeInsurance(String DyanamicQuery);
or at least the conditions part
@Query(value = "SELECT c FROM PrizeInsuranceConfiguration c WHERE :DyanamicConditions")
List<PrizeInsuranceConfiguration> filterConfigurPrizeInsurance(String DyanamicConditions);
Do, you can do that. There are two reasons why not:
But if you need dynamic query you can use Specifications, Query by Example or Querydsl.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With