-->
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: how to implement this using hql?
PostPosted: Wed Aug 31, 2005 8:08 am 
Newbie

Joined: Wed Aug 31, 2005 7:49 am
Posts: 1
dear all,

I meet this problem, I have 2 tables, CLASS and STUDENT

I am trying to run this sql:
select class.class_id, minScore from
CLASS class,
(
select class_id, min(score) as minScore
FROM STUDENT GROUP BY class_id
)A
where class.class_id = A.class_id
AND A.minScore<60

This sql is right, but I tried many times , and can't change it to hql, can any one help me? Thank you very much!!!

BTW, I have modles classes generated by middleGen.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 12:29 pm 
Regular
Regular

Joined: Sat May 15, 2004 4:27 am
Posts: 79
cathysuo

the only way you have for writing your SQL is the createSQLQuery
function. It's not possible to do that with HQL only. I am talking about
the SELECT you are doing in the FROM.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 01, 2005 2:26 am 
Regular
Regular

Joined: Sat May 15, 2004 4:27 am
Posts: 79
I think also it's possible to use HQL if you change your query. Maybe that
querie it's the same that yours :

select ST.class_id, min(score) AS minScore
From STUDENT AS ST
GROUP BY ST.class_id
HAVING min(score) < 60

??


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.