-->
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.  [ 4 posts ] 
Author Message
 Post subject: Querying on a composite-id
PostPosted: Mon Oct 27, 2003 3:11 pm 
Regular
Regular

Joined: Tue Aug 26, 2003 3:34 pm
Posts: 54
Location: Farroupilha - Brasil
When I try to execute the query:

select max(p.id) from QueryParameter p where p.query.id = ?

I get the following error:

---
net.sf.hibernate.QueryException: path expr
ession ends in a composite value: querypar0_.id [select max(p.id) from com.estob
el.model.QueryParameter p where p.query.id = ?]
--

My class QueryParameter has a composite-id:

<composite-id>
<key-property name="id" column="param_id" type="int"/>
<key-many-to-one name="query" class="com.estobel.model.Query" column="query_id"/>
</composite-id>

How can I fix this error?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 27, 2003 3:51 pm 
Regular
Regular

Joined: Tue Aug 26, 2003 7:53 pm
Posts: 66
Location: Lakeland, Florida USA
try

Code:
where p.id.query = ?


See section 9.7 in the ref manual (id is like a reserved word).

Jeff


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 27, 2003 5:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Actually the following will work:


where p.id.id = ?


;-)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 27, 2003 8:16 pm 
Regular
Regular

Joined: Tue Aug 26, 2003 3:34 pm
Posts: 54
Location: Farroupilha - Brasil
Thanks. It works fine.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.