hibernate nativequery and uuid

From: Andrew <archa(at)pacific(dot)net(dot)au>
To: pgsql-general(at)postgresql(dot)org
Subject: hibernate nativequery and uuid
Date: 2008-07-31 21:57:50
Message-ID: 4892355E.9030903@pacific.net.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm currently using JPA with Hibernate as my ORM and have been able to
convince hibernate to play nicely with the Postgresql UUID. Most of my
queries have been in EJBQL using the JPA entity manager's createQuery.
However when I try to do a UNION, JPA only returned the results of the
first query, and ignored the other UNION queries, which is in line with
what I have read online, in that JPA does not support UNIONS.

So I'm currently attempting to go via a createNativeQuery call. The
keys on the target tables are PostgreSQL UUID data types. When doing so
I get the following error:

org.postgresql.util.PSQLException: ERROR: operator does not exist: uuid
= character varying

The only relevant thing I have been able to find relating to it is
http://archives.postgresql.org/pgsql-bugs/2007-12/msg00061.php which
suggests adding a ::uuid cast to the parameter.

However, when doing that, hibernate thinks that it is a named parameter
and complains.

org.hibernate.QueryException: Not all named parameters have been set

Hibernate's functionality to declare an escape character for a LIKE
clause does not apply to this. But in attempting to escape the colons,
getting various other hibernate parsing errors, so my attempts down this
path has not been of help.

Has anyone else run into this issue and been able to resolve it?

I'm using Postgresql 8.3.3 on Windows XP, Hibernate 3.2.6.GA and the
Postgresql 8.3-603 JDBC4 driver.

Thanks,

Andy

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lennin Caro 2008-07-31 21:59:29 Re: eliminating records not in (select id ... so SLOW?
Previous Message Ivan Sergio Borgonovo 2008-07-31 21:45:30 eliminating records not in (select id ... so SLOW?