-->
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.  [ 1 post ] 
Author Message
 Post subject: Querying unique records along with object creation
PostPosted: Fri Jun 05, 2009 12:34 am 
Newbie

Joined: Tue Nov 29, 2005 11:20 am
Posts: 9
Hi,
I am trying to write a HQL which fetches data and also constructs the result object as follows:

select new com.test.ResultDTO(c.countryid, c.countryname) from Country c

I need to get all unique countrynames. I tried the following

select new com.test.ResultDTO(c.countryid, distinct(c.countryname)) from Country c
select new com.test.ResultDTO(c.countryid, unieuq(c.countryname)) from Country c

but none seems to work. Can any one let me know how to write HQL for the same?

Regards,
Hari


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.