Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
JPQL 查询中是否有可能在LIKE列表中使用 a (与IN关键字一样)。
LIKE
IN
就像是:"Select a From Table a WHERE a.field LIKE IN :list"
"Select a From Table a WHERE a.field LIKE IN :list"
这样我就可以像这样设置参数:{"12%","13%","16%"} 还是我必须动态链接许多 OR 子句?
{"12%","13%","16%"}
THX,死灵
我认为这不可能按照您喜欢的方式进行,但是您可以使用几个 OR'ed 条件,例如Select * from table1 where x like "12%1234" OR x like "23%".
Select * from table1 where x like "12%1234" OR x like "23%"
如果这不起作用,因为列表太长或其他原因,也许查看标准 api 以编程方式或您需要的条件?