Open
Description
I think there is something not working while generating a query in a hierarchy of classes in which some derived classes have an association property with the same name but different many-to-one class. ie:
+----------+
+ mother +
+----------+
+-------------+ +-------------+
+ Child1 + + Child1 +
=============== ===============
| Thing:Thing1| | Thing:Thing2|
+-------------+ +-------------+
So if we look for a specific value of Thing property like this:
var result = session.Query<Mother>().Where(k => k is Child1 && (k as Child1).Thing.Id == "00001").ToList();
We do not find any record even if the record exists, as the query generated is left-joining the wrong table, ie:
select mother0_.Id as id1_0_, mother0_.Name as name3_0_,
mother0_.thingId as thingid4_0_, mother0_.kind as kind2_0_ from Mother mother0_
left outer join Thing2 thing2x1_ on
mother0_.thingId=thing2x1_.Id where mother0_.kind='1' and thing2x1_.Id=?"
That is, looks into table for Thing2, while we actually look for a Thing1...
Unit test in PR #3364