On Jul 31, 2008, at 5:57 PM, Andrew wrote:
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.
Could you use a view to hide the UNION?
Cheers,
M
No virus found in this incoming message.
Checked by AVG - http://www.avg.comVersion: 8.0.138 / Virus Database:
270.5.8/1582 - Release Date: 7/30/2008 6:37 PM