hi there !
I'm using this mapping to retrieve a list of all referenced objects of
type "Court":
<bag name="AllCourts" table="Court" lazy="true" inverse="true">
<key column="ParentTown" />
<one-to-many class="PT.Bellum.Common.DataTypes.Court" />
</bag>
Wherein the class Court is an abstract class with 2 concrete inherited
classes: PersonalCourt and TownCourt.
So the bag "AllCourts" contains objects of both types, PersonalCourt
and TownCourt.
Is there a way to tell one-to-many to only list relations of type
"PersonalCourt" ? If I set <one-to-many
class="PT.Bellum.Common.DataTypes.PersonalCourt> still BOTH types of
courts are retrieved and I get an exception when trying to cast to
PersonalCourt.
I use an table-per-hierarchy mapping strategy with the discriminator
column called "class". So the workaround I use at the moment is:
<bag name="PersonalCourts" table="Court" lazy="true"
where="class = 'PT.Bellum.Common.DataTypes.PersonalCourt'"
inverse="true">
<key column="ParentTown" />
<one-to-many class="PT.Bellum.Common.DataTypes.PersonalCourt" />
</bag>
This works, but it will fail as soon as PersonalCourt will be
inherited by other classes.
Any ideas ?
Greetz,
Thomas
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---