HQL syntax problem
I have a problem with the following HQL query:

    select sum(MYTABLE.COUNTER) from (
                      
    select count(DISTINCT bi.products.id)  COUNTER 
                       from BusinessInformation as bi 
                       where bi.informationOwners.id in (100) 
                       and bi.products.id in (10) 
                       and bi.valueAmount not in ('NA')
                       and ((bi.valueType = 'ACHIEVED' and bi.referenceYears.id = 1) or (bi.valueType = 'FINAL_BALANCE' and bi.referenceYears.id = 2)) 
                       group by bi.informationOwners.id                   
    )  MYTABLE

The compiler reports:

    org.hibernate.hql.ast.QuerySyntaxException: unexpected token: ( near line 1, column 34

Do you have any idea what's wrong with the query? I tested the inner query and it works fine.

Thanks, 
C
HQL syntax problem
===

I have a problem with the following HQL query:

    select sum(MYTABLE.COUNTER) from (
                      
    select count(DISTINCT bi.products.id)  COUNTER 
                       from BusinessInformation as bi 
                       where bi.informationOwners.id in (100) 
                       and bi.products.id in (10) 
                       and bi.valueAmount not in ('NA')
                       and ((bi.valueType = 'ACHIEVED' and bi.referenceYears.id = 1) or (bi.valueType = 'FINAL_BALANCE' and bi.referenceYears.id = 2)) 
                       group by bi.informationOwners.id                   
    )  MYTABLE

The compiler reports:

    org.hibernate.hql.ast.QuerySyntaxException: unexpected token: ( near line 1, column 34

Do you have any idea what's wrong with the query? I tested the inner query and it works fine.

Thanks, 
C