JPA lower() function on parameter

喜你入骨 提交于 2020-01-16 11:04:12

问题


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);

now, on getting result I got

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.

but if I call

getQuery(getSelect() + "where lower(o.email) = lower('test')")

or

getQuery(getSelect() + "where lower(o.email) = lower(:email)").setParameter("email", "test")

it works fine.


回答1:


setParameter("email", email, StringType.INSTANCE) - solved my issue, thanks for help!



来源:https://stackoverflow.com/questions/27663235/jpa-lower-function-on-parameter

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