NHibernate Many-To-One on Joined Sublcass with Filter

Posted by Nathan Roe on Stack Overflow See other posts from Stack Overflow or by Nathan Roe
Published on 2010-06-16T00:43:42Z Indexed on 2010/06/16 0:52 UTC
Read the original article Hit count: 634

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about c#

Related posts about nhibernate