-->
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.  [ 2 posts ] 
Author Message
 Post subject: Help with HQL
PostPosted: Sun May 06, 2007 12:07 pm 
Newbie

Joined: Mon Mar 26, 2007 5:26 am
Posts: 10
3.2

Hi!

Can someone tell me what's wrong with the following HQL query?

from Movie m join fetch m.user where m.isActive = 1
and m.id > (select max(id) - ? from movies as rslt)
and m.id < rslt + ? order by m.id desc

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 07, 2007 12:38 am 
Regular
Regular

Joined: Mon Mar 26, 2007 12:38 am
Posts: 119
Hi,
Here is a guess.

(select max(id) - ? from movies as rslt)
i) lets us use rslt as an alias for table movies and not to capture the result of the query.
ii) It's scope is restricted to subquery.

So, when it is used later,
m.id < rslt + ?
rslt is expected to hold a result but is not available.

Correct me if I am wrong.

-----------------------------------------
Rate the reply if you find it helpful


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