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 to filter a bag of joined-subclasses based upon a
super-class property?
Using the example from the OP my mappings look a bit like this.
<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>
<class name="Other">
...
<bag name="Children">
<key column="OtherId" />
<one-to-many class="Child" />
<filter name="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 the filter would be
applied as sql not hql. However I need a way to filter based on a
column from the super-class table. I've tried using the parent class
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?