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: Need help in HQL : select new List(...) from ...
PostPosted: Tue Jul 26, 2005 2:15 am 
Beginner
Beginner

Joined: Fri Jun 25, 2004 5:31 am
Posts: 31
Hibernate version: 3

Name and version of the database using:Oracle 8i

Name and version of the app server using:JBoss 4.0.1



I want to write an HQL to get a result like :

Code:
CountryID           HotelID           HotelName
______________________________________________

C01                    H01                A
                       H02                B
                       H03                C



instead of result rows repeating for country ID as :

Code:
CountryID           HotelID           HotelName
______________________________________________

C01                    H01                A
C01                    H02                B
C01                    H03                C



The HQL i require is something like the one below, in which the select part consists of individual columns and one or more collections which doesn't work. Is that possible? My HQL would look something like:

Quote:
String query =
select c.Id, new List(hotels.Id, hotels.name)
from Country c join c.hotels hotels


Query q = session.createQuery(query);
List result = q.list();



exception is :

Code:
2005-07-26 12:08:44,646 ERROR [org.hibernate.hql.PARSER] *** ERROR: line 1:22: unexpected token: ,


I do not want to query directly the DAO (even though it solves the above) since i require to pass the query result to a different layer in which DAO's are not accessible.

pls help

thanks in advance
Shanika


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 26, 2005 7:18 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
yes, this is not supported.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 27, 2005 2:06 am 
Beginner
Beginner

Joined: Fri Jun 25, 2004 5:31 am
Posts: 31
thanks for the reply


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.