This works with one slight change. There seems to be some attempt on
NHibernate's part to map the columns in the filter condition. I had to
change it to:

"ParentId NOT IN (SELECT p.ParentId FROM Parent p WHERE p.IsDeleted =
1)"

On Jul 13, 9:40 am, Joel P <[email protected]> wrote:
> That's a good idea. I will have to try that approach. My only concern
> would be performance.
>
> On Jul 12, 2:05 am, CSharper <[email protected]> wrote:
>
>
>
>
>
>
>
> > I am not experienced with those filters but if it's some kind of raw
> > SQL you can write in the conditions, you could try a subselect
> > "ParentId NOT IN (SELECT ParentId FROM Parent WHERE IsDeleted = 1)"
>
> > On 29 Jun., 20:55, Joel P <[email protected]> wrote:
>
> > > I just ran into a problem today which is quite well described in this
> > > SO question:http://stackoverflow.com/q/3050050/65611
>
> > > Is there anyway tofiltera bag ofjoined-subclasses based upon a
> > > super-classproperty?
>
> > > Using the example from the OP my mappings look a bit like this.
>
> > > <classname="Parent">
> > >   <id .. />
> > >   <property name="IsDeleted" type="System.Boolean">
> > >     <column name="IsDeleted" />
> > >   </property>
> > >   <joined-subclassname="Child">
> > >     <key>
> > >       <column name="ParentId" />
> > >     </key>
> > >     ...
> > >   </joined-subclass>
> > > </class>
>
> > > <classname="Other">
> > >   ...
> > >   <bag name="Children">
> > >     <key column="OtherId" />
> > >     <one-to-manyclass="Child" />
> > >     <filtername="deletedFilter" condition="IsDeleted = 0" />
> > >   </bag>
> > > </class>
>
> > > When I try to use this code I get the error: "Invalid column name
> > > 'IsDeleted'" which makes perfect sense since thefilterwould be
> > > applied as sql not hql. However I need a way tofilterbased  on a
> > > column from the super-classtable. I've tried using the parentclass
> > > table name (condition="Parent.IsDeleted = 0") but I get "The multi-
> > > part identifier 'Parent.IsDeleted" could not be bound." doubtless
> > > because the table is aliased.
>
> > > Any solutions to this issue?

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to