how to escape colon in HQL

霸气de小男生 提交于 2019-12-24 18:05:40

问题


I have condition part of my query as follows:

...
where foo.bar like '%:%'

the query would execute but with no result. I think it's because of the colon since it is a reserved char in HQL. So how can I escape it without sending the : as a parameter to my query.

I have already used '%\:%' and '%\\:%' with no success.


回答1:


I found a solution: q=q.replaceAll(":","'||unistr('\\003A')||'");



来源:https://stackoverflow.com/questions/18614960/how-to-escape-colon-in-hql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!