Hello,
I have problem with hql .

  class A is master and have many-to-one class B (foreign key relation)
when I do hql with aggregate function and i group-list have only one column 
from class B it work,
but when I have identifier (composite primary key) and yet anotehr column it 
don't work

example :
   class A :  table A
      id - identifier    column a                         
      b   - many-to-one to b column b
      value - number property column value

   class B - table B

     id          - identifier  column id
     name  -  column name
     description - column description

this like :
  select a.id,a.b.id,sum(a.value)
  from A as a
  group by a.id,b.id

this work too
  select a.b.name,a.b.description,sum(a.value)
  from A as a
  group by a.b.name,a.b.description

but this don't work
  select a.b.id,a.b.name,sum(a.value)
  from A as a
  group by a.b.id,a.b.name

hql in last query in select list (group by columns) get a.b.id from table a 
(for example select a.b)
and in group by list from table b and I have sql like :

select A.B,b.name,sum(a.value)
from a,b
where a.b=b.id
group by B.ID,b.name

database return error no GROUP BY column

It work same in hibernate 2 and hibernate 3 - it isn't important database - 
every database dont' work with this sql

regards
Haris Peco
   

     


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to