nhibernate-core
nhibernate-core copied to clipboard
NH-3187 - Ability to filter a bag with where in mapping by inherited columns
Alexander Zaytsev created an issue — :
<class name="Person"> <id name="Id" generator="guid.comb" /> <property name="Name"/> <property name="IsDeleted"/> <joined-subclass name="Policeman"> <key column="PersonId" /> <many-to-one name="Station" column="StationId" /> </joined-subclass> </class> <class name="Station"> <id name="Id" generator="guid.comb" /> <bag name="Policemen" where="IsDeleted = 0"> <key column="StationId" /> <one-to-many class="Policeman"/> </bag> </class>
Accessing to station.Policemen generates wrong sql:
SELECT policemen0_.StationId as StationId1_, policemen0_.PersonId as PersonId1_, policemen0_.PersonId as Id0_0_, policemen0_1_.Name as Name0_0_, policemen0_1_.IsDeleted as IsDeleted0_0_, policemen0_.StationId as StationId1_0_ FROM Policeman policemen0_ inner join Person policemen0_1_ on policemen0_.PersonId=policemen0_1_.Id WHERE ( policemen0_.IsDeleted = 0 -- should be policemen0_1_ ) and policemen0_.StationId=@p0;
Alexander Zaytsev added a comment — :
Test commited
I am having this same issue. Looking forward to a fix!