Hibernate Books

All times are UTC - 5 hours [ DST ]

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: multi-column id and HQL
PostPosted: Wed Sep 17, 2003 5:38 am 

Joined: Mon Sep 15, 2003 8:06 am
Posts: 8

I try to compare a relation with an already-loaded persistent object
in HQL, where ids of the objects are multi-column ids (hibernate 2.0.3).

Here is the declaration of id (no composite-id, because need to have
a custom type to manage my id and composite-id do not have a type
attribute) :
<id name="key" type="test.hibernate.IRKeyType">
<column name="classId"/>
<column name="id" />
<generator class="test.hibernate.IRKeyGenerator">
<param name="classId">1024</param>

The following HQL fails with a 'path expression ends in a composite value' :
"from test.hibernate.Dumb as res where res.linked=?"
where I called setEntity(0, linkedObject) in the Query (linkedObject
being another persistent object of the same class).

As columns cannot be named in a <id> (while they can be named in
<composite-id>) I cannot do something like 'where res.linked.key.id=?'
as it is suggested in the doc for composite-id. As I need custom type
for my id, I cannot use composite-id neither.

Is it possible to make this thing work, or does it need a modification in
the way Hibernate parses equality in HQL, allowing composite values
to be compared ?

Thanks in advance for any advice.

Emmanuel Ligne

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

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.