| Hi. I think this bug has been introduced back in 5.4.5 version. We encountered this issue in one of our HQL queries, when we were using a child class in a join with a field from its parent. This is our query:
SELECT DISTINCT ol FROM OrderLineStockAllocation olStckAlloc
JOIN olStckAlloc.orderLine ol
ON olStckAlloc.transportUnit
IN :transportUnits;
And we had to adjust it like this to make it work:
SELECT DISTINCT ol FROM OrderLineAllocation olAlloc
JOIN olAlloc.orderLine ol
ON olAlloc.transportUnit
IN :transportUnits;
OrderLineStockAllocation is a child of OrderLineAllocation. orderLine field is on the parent class, OrderLineAllocation. transportUnit field is on the child class, OrderLineStockAllocation. The query that we adjusted, doesn’t fail because when we use parent class (OrderLineAllocation) in HQL, the generated query seems to join all the child classes, so it will have access to transportUnit field. Do you guys have any idea why the first query might not work? |