-->
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: HQL Left Join
PostPosted: Tue Jun 13, 2006 2:52 pm 
Regular
Regular

Joined: Wed Sep 29, 2004 11:34 am
Posts: 62
Location: Houston, TX
This is an odd request but one of our queries works fine in SQL but it is unable to fetch the results in Hibernate.

The following is the structure:

Booking {
ID Long,
PaymentDate Date,
EmployeeID Int,
.
.
.
}

We want to query for records of the Employees, for how many bookings created versus of those bookings how many were sold.

So we need to do a left join on booking.
The following is the sql query:
select b1.employeeid, count(b1.Id), count(b2.Id) from Booking b1 left join Booking b2 where b1.Id = b2.Id group by b1.employeeid;

We do a similar query in HQL but it gives an error.


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.