-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Sorting by a collection property
PostPosted: Tue Jul 03, 2007 2:30 pm 
Newbie

Joined: Tue Jun 19, 2007 11:34 am
Posts: 2
I have a table that links to a second table by a <one-to-many> collection. My second table contains a property named Title.

My first table looks something like this :

Code:
<class name="Table1" table="...">
    <id name="ProgramID" column="id_Program">
      <generator class="assigned" />
    </id>
    <set name="ExtendedInfo">
      <key column="id_program"/>
      <one-to-many class="Table2"/>
    </set>
  </class>


My second table looks something like this :

Code:
<class name="Table2" table="...">
    <composite-id >
      <key-property name="ProgramID" column="id_Program"/>
      <key-property name="Language" column="Language"/>
    </composite-id>
    <property name="OfficialTitle" column="OfficialTitle"/>
  </class>


When I do my select, I'd like to be able to sort by OfficialTitle. That would look something like this :

Code:
IList myList =
myNHibernateSession.CreateCriteria(typeof(Table1)).
AddOrder(Expression.Order.Asc"ExtendedInfo.OfficialTitle").
List();


The problem is I can't access that Table2 property.

Anyone knows how I could do this?

Thank you
Olivier Dupuis


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.