Hibernate version:2.1
Full stack trace of any exception that occurs:
16:40:37,269 WARN [JDBCExceptionReporter] SQL Error: 979, SQLState: 42000
16:40:37,276 ERROR [JDBCExceptionReporter] ORA-00979: not a GROUP BY expression
Name and version of the database you are using:Oracle 10g
The generated SQL (show_sql=true):
Code:
select host0_.id as id, host0__1_.ver as ver7_ from host host0_
inner join core_entity host0__1_ on host0_.id=host0__1_.id
inner join address addresses1_ on host0_.id=addresses1_.host_id
group by host0_.id
order by min(addresses1_.ip) asc
Hi Hibernate folks.
I have issued a query that looks like this:
Code:
select host
from Host host
join host.addresses addr
group by host
order by min(addr.ip) asc
I did not add my noisy map files since the case is almost identical to the example HQL shown in Hibernate reference section 11.10:
Code:
select cat
from eg.Cat cat
join cat.kittens kitten
group by cat
having avg(kitten.weight) > 100
order by count(kitten) asc, sum(kitten.weight) desc
as one can see the generated sql is erronous because the version appears in the select but not in the group by.
The way to workaround this is to add the version to the HQL:
Code:
select host
from Host host
join host.addresses addr
group by host, host.version
order by min(addr.ip) asc
It seems logical to me that the version property should be transparent to the HQL writer.
Am I missing something ?