Re: hibernate nativequery and uuid

From: Andrew <archa(at)pacific(dot)net(dot)au>
To: "A(dot)M(dot)" <agentm(at)themactionfaction(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: hibernate nativequery and uuid
Date: 2008-08-02 04:08:26
Message-ID: 4893DDBA.5040208@pacific.net.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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
>>
>>
>>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Yi Zhao 2008-08-02 06:22:48 why so many error when I load the data to database from a script which generated by pg_dump.
Previous Message Scott Marlowe 2008-08-02 01:07:08 Re: [SQL] Savepoints and SELECT FOR UPDATE in 8.2