-->
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: Nested Select in HQl
PostPosted: Mon Mar 30, 2009 12:15 am 
Newbie

Joined: Tue Mar 10, 2009 10:48 pm
Posts: 18
Hi, I have the following SQL.

select temp
from
( select list.id,
list.name,
list.address
from User list) asl


How do I implement it using HQL?? I have the following errors:
org.hibernate.QueryException: in expected: SELECT


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 30, 2009 4:42 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
Try using an IN clause like:

select list.id, list.name, list.address from User list where list.id IN (select id from User)

_________________
Regards,
Litty Preeth


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 30, 2009 5:08 am 
Newbie

Joined: Tue Mar 10, 2009 10:48 pm
Posts: 18
Thank you sooooo much!!!
I am gonna give it a try!!


Top
 Profile  
 
 Post subject: Re: Nested Select in HQl
PostPosted: Tue Apr 08, 2014 9:12 am 
Newbie

Joined: Tue Apr 08, 2014 9:08 am
Posts: 1
See documentation Hibernate http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/queryhql.html#queryhql-subqueries .
Subqueries are only allowed in SELECT or WHERE .


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.