-->
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.  [ 4 posts ] 
Author Message
 Post subject: HQL Query: FROM(SELECT...
PostPosted: Wed Jun 14, 2006 3:23 am 
Newbie

Joined: Wed Jun 14, 2006 3:17 am
Posts: 2
Hello!!

I'm spanish (sorry for my bad english). I need to do a HQL Query but I've an error with the "(" ...

I want to translate this:

SELECT a.id, b.name,....
FROM (
SELECT a.id, b.name, c.adress.....
FROM.......
......
)
GROUP BY a.id, b.name....

to HQL query

Can anyone of you help me??

Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 14, 2006 2:02 pm 
Newbie

Joined: Tue Jun 13, 2006 12:12 pm
Posts: 3
Unfortunately HQL does not support subqueries in the FROM clause. An excerpt from Hibernate In Action (section 7.5.3):
Quote:
Subselects are an important and powerful feature of SQL. A subselect is a select query embedded in another query, usually in the SELECT, FROM, or WHERE clause.
HQL supports subqueries in the WHERE clause.


So you cannot write a subquery in the FROM clause. Maybe you can try a native SQL query.

Regards,
Martin


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 14, 2006 2:27 pm 
Newbie

Joined: Wed Jun 14, 2006 3:17 am
Posts: 2
Ok! I needed to do it with HQL but, if it is not possible, i'll try to find another way to write the query. Thank you so mutch!!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 31, 2008 5:36 am 
Beginner
Beginner

Joined: Thu Jun 30, 2005 1:04 pm
Posts: 26
Hello

Is it possible now with Hibernate 3.2.4 ?

Thanks


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