-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: HQL with join using composite-id on Oracle 9i
PostPosted: Mon Jun 12, 2006 5:38 am 
Newbie

Joined: Wed Dec 15, 2004 1:58 pm
Posts: 16
Location: Prague, Czech Republic
I've got a problem using HQL with join using composite-id on Oracle 9i.
When I joint classes like:

... where idfklient=idfklientucet.klient ....

and then generated sql:

... where (klu.idklient,klu.dotaz_id,klu.sablona_id)=(k.idklient,k.dotaz_id,k.sablona_id) ...

This should join by composite-id, but generated SQL fails on Oracle (Postgres 8.1 is fine).
Is this a dialect implementation problem or HQL processor problem?

I can use workaround providing full list of columns in HQL.
(idfklinet.idKlient=idfklientucet=idKlient and idfklinet.dotazID=idfklientucet.dotazID and idfklient.tabulkaVSabloneID=idfklientucet.tabulkaVSabloneID)

But it is not comfortable and could cause some migration problems (developing under Postgres and then trying to migrate under Oracle).

Is this a bug? Shall I post it into JIRA?

Hibernate version:
3.1.2

Mapping documents:
<class name="IdfKlient" table="idfklient" node="cz.aegis.idf.db.model.idf.IdfKlient">
<composite-id name="id"
class="cz.aegis.idf.db.model.idf.base.IdfKlientPK">
<key-property name="idKlient" column="idklient" type="string" length="25" />
<key-property name="dotazID" column="dotaz_id" type="long" />
<key-property name="tabulkaVSabloneID" column="sablona_id" type="long" />
</composite-id>
</class>



<class name="IdfKlientUcet" table="idfklientucet" node="cz.aegis.idf.db.model.idf.IdfKlientUcet">
<composite-id name="id" class="cz.aegis.idf.db.model.idf.base.IdfKlientUcetPK">
<key-property name="idKlient" column="idklient" type="string" length="25"/>
<key-property name="idUcet" column="iducet" type="string" length="42"/>
<key-property name="dotazID" column="dotaz_id" type="long" />
<key-property name="tabulkaVSabloneID" column="sablona_id" type="long" />
</composite-id>
<many-to-one name="klient" embed-xml="false" class="IdfKlient"
not-null="false" insert="false" update="false">
<column name="idklient" />
<column name="dotaz_id" />
<column name="sablona_id" />
</many-to-one>
</class>


Name and version of the database you are using:
Oracle 9i with org.hibernate.dialect.Oracle9Dialect

The generated SQL (show_sql=true):
... where (klu.idklient,klu.dotaz_id,klu.sablona_id)=(k.idklient,k.dotaz_id,k.sablona_id)


Top
 Profile  
 
 Post subject: Re: HQL with join using composite-id on Oracle 9i
PostPosted: Mon Jun 12, 2006 11:43 am 
Newbie

Joined: Tue May 24, 2005 11:25 am
Posts: 16
Take a look on this one. It allowes a lot of flexibility when using joins.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.