Hello,

If we have a filter applied on a set (say, "ISDELETED = 0"), and we
are eagerly loading the set elements with a JOIN (fetch="join"), the
WHERE clause for the filter is applied on the entire SELECT, but it
should be on the ON clause. For example:

SELECT a.ID,
a.SOMEFIELD,
b.ID,
b.FKID,
b.SOMEOTHERFIELD,
b.ISDELETED
FROM a
LEFT JOIN b
ON b.FKID = a.ID
WHERE b.ISDELETED = 0

But instead it should be:

SELECT a.ID,
a.SOMEFIELD,
b.ID,
b.FKID,
b.SOMEOTHERFIELD,
b.ISDELETED
FROM a
LEFT JOIN b
ON b.FKID = a.ID AND b.ISDELETED = 0

What happens with the current version is, if B has no records, then no
records are returned at all, even if A has them.
There is a JIRA issue submitted by Ayende in 2009, I think it refers
to this problem: http://216.121.112.228/browse/NH-1930.
Is anyone working on this?

Thanks!

RP

Reply via email to