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