If you are working with a legacy database (equals "you can not modify
the tables") then you should take Ken's approach.
If not, and you can modify the tables, you need 2 IDs in the
TblStudent, and your mappings would be (note the inverse false and the
column names):
...
<bag name="Boys" generic="true" table="`tblStudents`" inverse="false"
cascade="all-delete-orphan">
<key column ="`IdSchool1`"></key>
<one-to-many class ="Eg.Student,Eg" />
</bag>
<bag name="Girls" generic="true" table="`tblStudents`" inverse="false"
cascade="all-delete-orphan">
<key column ="`IdSchool2`"></key>
<one-to-many class ="Eg.Student,Eg" />
</bag>
...
This way you have unidirectional navigation from School to Boys or
Girls collection.
If you need additional "bidirectional" navigation, you can always add
a new many-to-one to School from students, and add a third ID in
TblStudents.
...
<many-to-one name="School" column="IdSchool" class="Eg.School, Eg" not-
null="true" lazy="false">
</many-to-one>
...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---