JPA lower()函数参数 [英] JPA lower() function on parameter
本文介绍了JPA lower()函数参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已将项目从3.2更新到4.1,hibernate 4.2更新到4.3.7,并获得了有趣的问题。
我有查询:
I have updated project from spring 3.2 to 4.1 and hibernate 4.2 to 4.3.7 and got interesting problem. I have query:
function parameter: String email;
getQuery(getSelect() + "where lower(o.email) = lower(:email)").setParameter("email", email);
现在,我得到了结果
org.postgresql.util.PSQLException:错误:函数lower(bytea)不存在
提示:没有函数匹配给定的名称和参数
类型。您可能需要添加明确的类型转换。
org.postgresql.util.PSQLException: ERROR: function lower(bytea) does not exist Hint: No function matches the given name and argument types. You might need to add explicit type casts.
但是如果我打电话
getQuery(getSelect() + "where lower(o.email) = lower('test')")
或
getQuery(getSelect() + "where lower(o.email) = lower(:email)").setParameter("email", "test")
它工作正常。
推荐答案
setParameter(email,email,StringType.INSTANCE) - 解决了我的问题,感谢您的帮助!
setParameter("email", email, StringType.INSTANCE) - solved my issue, thanks for help!
这篇关于JPA lower()函数参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文