-->
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: Help with constructing a Criteria query
PostPosted: Thu Jun 09, 2005 1:33 pm 
Newbie

Joined: Thu Jun 09, 2005 1:18 pm
Posts: 1
Hibernate version: 3.0.2

Mapping documents: CmChart.hbm.xml, CmClient.hbm.xml

Hello

I'm trying to figure out what Criteria code I would use for the following HQL query:

Code:
SELECT DISTINCT chart.client FROM CmChart chart WHERE chart.client IS NOT NULL AND chart.client.isActive = :isActive ORDER BY chart.client.clientName


Where a chart has a single client, which has the properties isActive and clientName. Basically, I'm trying to select all the unique clients who are associated with a chart and are active, ordered by their name. The above HQL works perfectly well, however when I try and create a Criteria to do the same thing I can't manage to get it to work (usually "can't resolve property XXX of YYY"). I can manage to get parts of it to work, but I can't put all of the addOrder() and setProjection() and createCriteria() together no matter how I try.

Thanks
James


Top
 Profile  
 
 Post subject: Re: Help with constructing a Criteria query
PostPosted: Thu Jun 09, 2005 2:18 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
jgm wrote:
Hibernate version: 3.0.2

Mapping documents: CmChart.hbm.xml, CmClient.hbm.xml

Hello

I'm trying to figure out what Criteria code I would use for the following HQL query:

Code:
SELECT DISTINCT chart.client FROM CmChart chart WHERE chart.client IS NOT NULL AND chart.client.isActive = :isActive ORDER BY chart.client.clientName


Where a chart has a single client, which has the properties isActive and clientName. Basically, I'm trying to select all the unique clients who are associated with a chart and are active, ordered by their name. The above HQL works perfectly well, however when I try and create a Criteria to do the same thing I can't manage to get it to work (usually "can't resolve property XXX of YYY"). I can manage to get parts of it to work, but I can't put all of the addOrder() and setProjection() and createCriteria() together no matter how I try.

Thanks
James


If you post the code you've written and the errors you're getting, it'll be easier to help.


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.