views:

119

answers:

1

I have a class setup that looks something like this:

public abstract class Parent
{
    public virtual bool IsDeleted { get; set; }
}

public class Child : Parent
{
}

public class Other
{
    public virtual ICollection<Child> Children { get; set; }
}

Child is mapped as a joined-subclass of Parent. Childen is mapped as a Many-To-One bag. The bag has a filter applied to it named SoftDeletableFilter. The filter mapping looks like:

<filter-def name="SoftDeleteableFilter" condition="(IsDeleted = 0 or IsDeleted is null)" />

That problem is that when Other.Children is loaded the filter is being applied to the Child table and not the parent table. Is there any way to tell NHibernate to apply the filter to the parent class?

Edit: Here's the parent mapping:

<class name="Parent">
  <id ..
  <property name="IsDeleted" type="System.Boolean">
    <column name="IsDeleted" />
  </property>
  <joined-subclass name="Child">
    <key>
      <column name="ParentId" />
    </key>
    ...
  </joined-subclass>
</class>
A: 

How is the mapping defined for Parent? Just to be sure, the IsDeleted property is defined in the mapping for Parent, right?

Please show the mapping for Parent & Child.

Otherwise it looks like a bug.

Torkel
I added the mapping above.
Nathan Roe