mysql like 查询 有单引号的处理办法。org.hibernate.QueryException: expecting ''', found '<EOF>' [SELECT DISTINCT
来源:互联网 发布:咖啡厅收银软件 编辑:程序博客网 时间:2024/06/05 14:20
org.hibernate.QueryException: expecting ''', found '<EOF>' [SELECT DISTINCT D FROM XXX ]
原因就是有单引号,然后 sql语句加上 \' 转义字符。 或用 2个单引号。''
在hibernate的查询中不能用 \’ , 可以用'' 代替。
即:
'%"+StringEscapeUtils.escapeSql(_mediaName)+"%'
Open Declaration String org.apache.commons.lang.StringEscapeUtils.escapeSql(String str)Escapes the characters in a String to be suitable to pass to an SQL query.For example, statement.executeQuery("SELECT * FROM MOVIES WHERE TITLE='" + StringEscapeUtils.escapeSql("McHale's Navy") + "'");At present, this method only turns single-quotes into doubled single-quotes ("McHale's Navy" => "McHale''s Navy"). It does not handle the cases of percent (%) or underscore (_) for use in LIKE clauses.see http://www.jguru.com/faq/view.jsp?EID=8881Parameters:str the string to escape, may be nullReturns:a new String, escaped for SQL, null if null string input
0 0
- mysql like 查询 有单引号的处理办法。org.hibernate.QueryException: expecting ''', found '<EOF>' [SELECT DISTINCT
- mysql单表递归查询(jpa[org.hibernate.QueryException: Space is not allowed afterQuery parameter prefix ':'])
- Hibernate MySQL select 或 insert 含有单引号(\')的string
- Got an exception - expecting xxx found EOF
- org.hibernate.QueryException: query must……的解决方案
- 异常org.hibernate.QueryException: could not resolve property的原因
- 异常org.hibernate.QueryException: could not resolve property的原因
- hibernate用like进行模糊查询时不能写单引号!!!
- org.hibernate.QueryException: query must begin with SELECT or FROM: delete
- org.hibernate.QueryException: query must begin with SELECT or FROM: delete
- Caused by: org.hibernate.QueryException: query must begin with SELECT or FROM:
- org.hibernate.QueryException: query must begin with SELECT or FROM: delete
- org.hibernate.QueryException: Expected positional parameter count: 2, actual parameters: [] [SELECT
- MySQL SELECT LIKE like的用法
- org.hibernate.QueryException: could not resolve property:xxxxxid 外键查询 hibernate
- 数据库expecting ''', found '<EOF>'异常——原载于我的百度空间
- hibernate hql like 查询有特殊字符
- hibernate hql语句中条件参数中包含特殊字符单引号' 的处理办法
- 孤岛连通工程_1314
- GET和POST的区别
- HDOJ 1284 钱币兑换问题(DP)
- Language ID
- 如何在SharePoint中配置和自定义Content Query Web Part(一)
- mysql like 查询 有单引号的处理办法。org.hibernate.QueryException: expecting ''', found '<EOF>' [SELECT DISTINCT
- 使用VISIO画状态图的几点注意事项
- ActivityGroup相关--getLocalActivityManager()
- Android中级篇之百度地图SDK v3.5.0-申请密钥详解[AndroidStudio下获取SHA1]
- 内核模块编译
- xoj 1754 80人环游地球(tour)题解
- pom.xml一些记录
- URL中的特殊字符含义及转化
- Badboy自动化测试工具 录制