-->
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.  [ 1 post ] 
Author Message
 Post subject: Nested queries and distinct keyword
PostPosted: Mon Apr 12, 2004 6:15 pm 
Regular
Regular

Joined: Fri Mar 26, 2004 11:45 am
Posts: 75
Hi.

I am having problems with returning objects from the nested HQL queries. Here is an example:

select distinct activity2, activity2.acttype, studact.status
from StudAct as studact, Activity as activity2 "
where studact.studid = 5
and studact.actid = activity2.actid
order by activity2.acttype.resumealways DESC,
studact.status DESC,
activity2.acttype.sort ASC

The problem is that the returned result cannot be casted to the Activity[]. If I am trying to use the above query as a nested query, I get the error saying "unknown alias activity2". Here is the nested query that I am trying to run:

select activity2 from (
// here goes the query above
)

What is the right way to select objects from nested queries?

Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.