问题
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