Reputation: 474
I am using spring-data-jpa
to run native postgres
queries. The query is performed on entity's jsonb data.
I can run the raw query on db server with success:
SELECT e.*
FROM public.entity e where e.json ? 'salary' and e.json ->> 'salary' > '10000';
But, since spring-data-jpa
also supports ?
for the parameterized queries, there seems to be conflict in the grammer of the query, therefore application eventually fails to even start.
@Query(value = "select e.* from Entity e where e.json ? 'salary' and e.json->> 'salary' > ?1", nativeQuery = true)
List<Lead> getEntitiesBySalaryGreaterThan(String value);
}
Please let me know the workaround or correct way of executing the intended native query in spring-data-jpa
env
Upvotes: 1
Views: 479