oops, forgot to cc the mailing list again...
Andrew wrote:
I know none of this relates directly to postgresql and on reflection
is probably more appropriate for the hibernate forums. So apologies
for having raised the topic here. Also, thanks for the suggestions
that I have received on the topic.
I have got the UNION working in a view via JPA. However, it was not
straightforward and the approach that I have taken is not that
efficient. So for those who are interested in some of the
implementation details...
Previously to get hibernate to use the postgresql uuid, I had to
create a custom hibernate UserType as well as extend the JDBC
postgresql driver. I then referenced the custom data type and a
custom UUID generator that I had created using JPA/hibernate
annotations in the entities.
However, the hibernate validation of views appears to be different
than with tables, so after creating the corresponding view entity, on
restarting the application server, I was getting the "No Dialect
mapping for JDBC type: 1111" exception, despite the view entity being
configured just like the table entities. So I had to change my
META-INF/persistence.xml to reference my extended JDBC postgresql
driver, rather than the original JDBC driver. For good measure, I
also did the same to my hibernate-console.properties file as part of
my eclipse environment.
This addressed the 1111 exception. But then I was hit with a
"javax.persistence.PersistenceException:
org.hibernate.HibernateException: Missing table: my_view" exception,
as there is an outstanding defect in hibernate related to how it
treats views. See
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1329.
Supposedly it was fixed in version 3.2.6, but I'm using version 3.2.6
GA and it is patently still an issue. So the only way around this at
present is unfortunately to turn off validation with the
hibernate.hbm2ddl.auto property in the META-INF/persistence.xml file.
But after all of that, I can now use JPA entities in EJBQL's to use a
view containing postgresql uuid's. Nothing like speaking gibberish
with an overuse of acronyms :-)
Cheers,
Andy
A.M. wrote:
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