Querying using ICriteria or QueryOver creates joins with conditions in the main WHERE clause instead of the JOIN clause.
This breaks left joins when using table-per-hierarchy discriminators as the condition in the WHERE clause effectively turns the left join into an inner join.
This bug only appears when any filter is enabled, whether the filter is used or not.
It also does not appear to affect queries written in HQL.
This mapping demonstrates the problem:
Querying using this HQL query works fine:
select e from Employee e left join e.Department d
This QueryOver query fails:
SQL generated for HQL query:
A test case will follow shortly.
I have also provided a patch containing a fix that appears to solve this issue. All unit tests still pass after this fix.