-->
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.  [ 2 posts ] 
Author Message
 Post subject: sort by collection count
PostPosted: Mon Nov 13, 2006 7:49 am 
Newbie

Joined: Tue Sep 26, 2006 10:59 am
Posts: 15
Hi all.
Can somebody help me?
I have 2 classes: Person and Photo. I map class Person as follows:
Code:
  <class name="Person" table="Person">
    <id name="ID" type="Int64" column="ID" unsaved-value="0">
      <generator class="identity"/>
    </id>
    <property name="Name" column="Name" />
    <bag name="Photos" inverse="true" cascade="all" >
      <key column="PersonID"/>
      <one-to-many class="Photo"/>
    </bag>
  </class>


I can get list of Person like this:
Code:
ICriteria c = session.CreateCriteria(typeof(Person));
IList lst = c.list();


But I want the first Persons was Persons who has a photo. How to do it?
Thanks.


Top
 Profile  
 
 Post subject: in additional
PostPosted: Mon Nov 13, 2006 8:18 am 
Newbie

Joined: Tue Sep 26, 2006 10:59 am
Posts: 15
In additional to previous post I want to say that I use SetMaxResults and SetFirstResult.


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

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.