【发布时间】:2019-06-21 21:38:07
【问题描述】:
我正在使用 spring-data-jpa 运行本机 postgres 查询。查询是在实体的 jsonb 数据上执行的。
我可以在数据库服务器上成功运行原始查询:
SELECT e.*
FROM public.entity e where e.json ? 'salary' and e.json ->> 'salary' > '10000';
但是,由于spring-data-jpa 也支持? 进行参数化查询,所以查询的语法似乎存在冲突,因此应用程序最终甚至无法启动。
@Query(value = "select e.* from Entity e where e.json ? 'salary' and e.json->> 'salary' > ?1", nativeQuery = true)
List<Lead> getEntitiesBySalaryGreaterThan(String value);
}
请告诉我在spring-data-jpa env 中执行预期本机查询的解决方法或正确方法
【问题讨论】:
标签: postgresql spring-data-jpa