Skip to content
Advertisement

Passing a query as a query parameter in JPQL Native Query

I’m trying to pass a query as a string parameter in another JPQL native query.

JavaScript

So the resulting query would be something like the query below that returns me a value

JavaScript

but what I’m getting in return is only the string of :query parameter and not the result of the executed complete query.

Advertisement

Answer

  1. Create an interface for a custom repository SomeRepositoryCustom
JavaScript
  1. Create an implementation of SomeRepositoryCustom
JavaScript
  1. Extend your JpaRepository with SomeRepositoryCustom
JavaScript

to run a query

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement