-->
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.  [ 3 posts ] 
Author Message
 Post subject: "case when" replacement for hql in select?
PostPosted: Thu May 26, 2005 3:02 pm 
Newbie

Joined: Wed May 25, 2005 4:46 pm
Posts: 4
I'm trying to create a query along the line of

select
new ReportItem(
count(case when date - getdate() > 10 then 1 else 0 end)
count(case when date - getdate() > 20 then 1 else 0 end)
count(case when date - getdate() > 30 then 1 else 0 end)
...
)
from class
group by classid

but apparently hql doesn't support "case when" in "select", what's my alternate for queries like these, I thought about using a iif UDF but that will kill the performance, subqueries will make the hql statement very lengthly, is there any other options?


Last edited by quixotry on Thu May 26, 2005 9:12 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu May 26, 2005 9:10 pm 
Newbie

Joined: Wed May 25, 2005 4:46 pm
Posts: 4
After a little digging around I found that there is no support for subquery in select either, therefore that option is out.

hibernate implemented "select case when" as mentioned in HHH-467, any chance that nhibernate can do the same thing in the near future?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 27, 2005 3:29 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Hmm, it's a Hibernate 3 feature, so I doubt about the near future. But please create an issue in JIRA so that we know it's wanted.


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