I stumbled across a workaround. If you use an attribute of the left-joined entity, rather than the entity to test for null, no UnknownTableReferenceException is thrown, and the query works properly. So, instead of:
select thing from Thing thing
left join thing.thingStats thingStats
where thingStats is null or thingStats.rejectedCount = 0
Use an attribute on the left-joined entity:
This only works when the joined entity has a non-nullable attribute (e.g.: a PK). |