Nhibernate joined subclass and orderby by base class

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

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

Thank...

  <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>

      

+2


source to share





All Articles