对于以下类映射:
<class name="Person" table="Person" discriminator-value="null">
<id name="ID" column="ID" >
<generator class="identity"/>
</id>
<discriminator column="MasterId" />
<property name="LongName" column="LONGNAME" />
<property name="ShortName" column="SHORTNAME" />
// other stuff here ...
<subclass name="PersonHistory" discriminator-value="not null">
<property name="MasterId" />
</subclass>
</class>
当我执行:
var query =
from lac in session.Query<Person>()
orderby lac.LongName
select lac;
return query.ToList();
我从Person表中获取所有条目,其中 MasterId 都设置为 null 而不是 null。有没有办法让 NHibernate 只获取 MasterId = null 的实体?