I have posted this to the fluent nhibernate group but not got much
response so maybe this (modified) question will be better.
Basically I have a Person class from which I have two inherited
classes, Author and Borrower (it's a library system). The mapping I
have is below.
Now if I run the HQL "FROM Author a ORDER BY a.Name" it will return a
list of all Author and Borrower entities where I obviously just want a
list of authors. Please feel free to set me straight on this.
Thanks, Craig
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
default-lazy="true" assembly="LibrarySample.Model"
namespace="LibrarySample.Model">
<class name="Person" table="person" xmlns="urn:nhibernate-mapping-2.2">
<id name="Id" column="id" type="Int32">
<generator class="identity" />
</id>
<property name="Name" length="100" type="String">
<column name="name" />
</property>
<joined-subclass name="LibrarySample.Model.Borrower,
LibrarySample.Model, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null" table="borrower">
<key column="id" />
<property name="UserName" length="100" type="String">
<column name="user_name" />
</property>
<bag name="Schedule" cascade="save-update">
<key column="borrower_id" />
<one-to-many class="LibrarySample.Model.BookSchedule,
LibrarySample.Model, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null" />
</bag>
</joined-subclass>
<joined-subclass name="LibrarySample.Model.Author,
LibrarySample.Model, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null" table="author">
<key column="id" />
<property name="Country" length="100" type="String">
<column name="country" />
</property>
<bag name="Books" cascade="all">
<key column="book_id" />
<one-to-many class="LibrarySample.Model.Book,
LibrarySample.Model, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null" />
</bag>
</joined-subclass>
</class>
</hibernate-mapping>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---