Hibernate 3.1 gives me a little bit different output. It actually generated a query for me, but the query uses a table alias that isn't actually defined in the query, and I get an error on that. The same exact HQL query above generates the following SQL query in 3.1:
select user0_.firstName as col_0_0_, user0_.lastName as col_1_0_, user0_.emailAddress as col_2_0_, orgunit3_.name as col_3_0_, count(distinct quotes2_.id) as col_4_0_, count(distinct applicatio1_.id) as col_5_0_ from user user0_ left outer join Application applicatio1_ on user0_.id=applicatio1_.user and (case when applicatio1_1_.id is not null then 1 when applicatio1_.id is not null then 0 end=1 and (applicatio1_.created between ? and ?)) left outer join quote quotes2_ on user0_.id=quotes2_.user and (case when quotes2_1_.id is not null then 1 when quotes2_.id is not null then 0 end=1 and (quotes2_.quoted between ? and ?)), orgUnit orgunit3_ where user0_.orgUnitId=orgunit3_.id group by user0_.id
|