tags:

views:

62

answers:

0

Hi Ive got a subclass, and I use this subclass on a bag, however I want to use the order by from the base class. But when I put the order by Nhibernate use the subclass. Does anyone know how to do this Ive put the mappings below.

If I run that the sql does ordeby PersonDocument.Name, but it should be Document.Name

Thanks...

  <bag name="Documents" cascade="all" order-by="Name" >
    <key column="PersonId"/>
    <one-to-many class="PersonDocument" />
  </bag>


<?xml version="1.0" encoding="utf-8" ?>

  <many-to-one name="Type" class="DocumentType" column="DocumentTypeId" not-null="false" cascade="all" />


  <joined-subclass table="PersonDocument"  name="PersonDocument">
    <key column="DocumentId"/>
    <many-to-one name="EventGroupType" class="EventGroupType" column="EventGroupTypeId" not-null="false" cascade="all" />
  </joined-subclass>

</class>