ekitru
ekitru

Reputation: 181

JPA lower() function on parameter

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.

Upvotes: 1

Views: 12120

Answers (1)

ekitru
ekitru

Reputation: 181

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

Upvotes: 0

Related Questions