Why is a Hibernate JPQL Type Cast necessary for String

456 views
Skip to first unread message

Reen

unread,
Dec 16, 2011, 5:17:44 AM12/16/11
to play-framework
Hi

For the query:

ApplicationRole.find("byName", name).first();

get the following error:

JPAQueryException occured : Error while executing query SELECT u FROM
ApplicationUser u WHERE u.userName = ?: ERROR: operator does not
exist: character varying = bytea Hint: No operator matches the given
name and argument type(s). You might need to add explicit type casts.


But only if I use postgres database. Has someone similar problems?

Stackoverflow Discussion:
http://stackoverflow.com/questions/8442294/why-is-a-hibernate-jpql-type-cast-necessary-for-string

BR: Rene

Aishwarya Singhal

unread,
Dec 16, 2011, 8:40:53 AM12/16/11
to play-framework
i assume name is string in your code and varchar in database ? it
seems to be more of postgres complaining rather than JPA.

btw have you seen https://hibernate.onjira.com/browse/EJB-404 ? looks
like an error similar to this was fixed in hibernate 3.4...

Best regards
Aishwarya

> Stackoverflow Discussion:http://stackoverflow.com/questions/8442294/why-is-a-hibernate-jpql-ty...
>
> BR: Rene

Reply all
Reply to author
Forward
0 new messages