-->
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: order by with select distinct elements()
PostPosted: Fri Jul 24, 2009 10:58 am 
Newbie

Joined: Fri Jul 24, 2009 10:49 am
Posts: 1
Hi,

my entity ContentItem has a List tags which is stored in her own table.
Now I want a list of all available tags, therefore I use the HQL query:

SELECT DISTINCT elements(tags) FROM ContentItem

which works fine.

But now I want this list to be literally sorted by tag which is a String

SELECT DISTINCT elements(tags) as singeTag FROM ContentItem ORDER BY singleTag

does not work,

SELECT DISTINCT elements(tags) FROM ContentItem ORDER BY elements(tags)

of course also does not work.

SELECT DISTINCT elements(tags) FROM ContentItem ORDER BY col_0_0_

works, but I don't really like depending on a generated name that I only know from looking at the log files, besides that my IDE is complaining.
Anyone any idea how to solve this?


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.