【发布时间】:2020-05-18 19:25:51
【问题描述】:
如何使用?| Spring存储库中postgres查询中的运算符?我需要在查询中使用 where 文本类型列,其中内容为 json。
@Query(value =
"SELECT * \n" +
"FROM tbl t \n" +
"WHERE t.some_ids::::jsonb ?| array['152960','188775']", nativeQuery = true
)
List<Model> getModelsByIds();
但这不起作用,我发现了下一个异常: org.springframework.dao.InvalidDataAccessApiUsageException:至少提供了 1 个参数,但查询中只存在 0 个参数。
【问题讨论】:
-
确实,混淆层确实让 Postgres 的潜力难以发挥