Pab*_*era 9 hibernate hql wildcard
如何在like子句中转义通配符?
例如:
select foo from Foo as foo where foo.bar like '%' || :filter ||'%'
query.setParameter("filter", "%");
query.list();
// I'd expect to get the foo's containing the '%' in bar, not all of them!
有任何想法吗?
Dea*_*vey 12
在Hibernate 3中,您可以使用escape参数指定转义字符:
select foo from Foo as foo where foo.bar like '!%' escape '!'
Run Code Online (Sandbox Code Playgroud)
我认为这应该有效,尽管我从未在实践中尝试过.
| 归档时间: |
|
| 查看次数: |
10518 次 |
| 最近记录: |