Hibernate return an empty result when the size function is used in a HQL Query.

Description

I'm using the following HQL and it return a correct result :

1 2 3 4 select distinct new net.rhuanrocha.dto.CompanyDto(c.id,c.name,0) from Company c left join c.customers cu where c.name =:name group by c.id, c.name

But when I use the size function in my HQL the query results is wrong (In my case is returning an empty result). Look this HQL:

1 2 3 4 select distinct new net.rhuanrocha.dto.CompanyDto(c.id,c.name,size(c.customers)) from Company c left join c.customers cu where c.name =:name group by c.id, c.name

Environment

  • JBoss EAP 7.1.6

  • SQLServer

Status

Assignee

Unassigned

Reporter

Rhuan Henrique Silva

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

5.3.11

Priority

Major