I was trying to execute the following query
return (from foo in _session.Query<Foo>()
where (from personBar in _session.Query<PersonBars>()
where personBar.Person.Id == _personId
select new SomeProjection(
basically the goal was to get all Foos with Bar that given user of the app has Bar for too.
now the part of the SQL generated that has a bug in it looks kind of like this (sorry for obscuring it):
where some clauses
and (exists (select bar_.ID
from PERSON_BAR pb
joins to bar
where some other clauses here
and pb.ID = foo0_.BAR_ID))
Notice the last line which should say
pb.BAR_ID = foo0.BAR_ID
that's the bug.
Hope that helps.