kir*_*rti 7 arrays postgresql jpa jpql
我正在使用 jpql 本机查询。
我有一个工作 postgresql 查询,我需要在 jpql 中实现。
Select * from sql_sent_sms where match_url LIKE any (array['%ctid=123%','%ctid=231%']);
这将显示与数组中 match_url 列的值匹配的所有行。
现在我想在 jpa 本机查询中使用它,但在提供数组时它给了我错误。
这是我尝试过的:
List<String> arrctid = Arrays.asList("%ctid=2141234%","%ctid=4be2a864-6e20-4686-b0f2-e3f432752c3d%");
Query query = em.createQuery("SELECT test.receiver FROM Sql_test test"+"WHERE test.match_url like any (arrctid) and test.service=:sysuserId ");
query.setParameter("arrctid", arrctid );
query.setParameter("sysuserId", sysuserId);
Run Code Online (Sandbox Code Playgroud)
我也尝试过
Query query = em.createQuery("SELECT test.receiver FROM Sql_test test"+"WHERE test.match_url like any (:arrctid) and test.service=:sysuserId ");
Query query = em.createQuery("SELECT test.receiver FROM Sql_test test"+"WHERE test.match_url like any :arrctid and test.service=:sysuserId ");
Run Code Online (Sandbox Code Playgroud)
但没有任何效果。
谁能告诉我如何像任何运算符一样设置数组参数。
归档时间: |
|
查看次数: |
1328 次 |
最近记录: |