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.  [ 4 posts ] 
Author Message
 Post subject: sorting on Session Load call
PostPosted: Tue Feb 27, 2007 7:51 pm 
Beginner
Beginner

Joined: Mon Oct 02, 2006 6:46 pm
Posts: 32
Hibernate version: 1.2.0 Beta 2

When I call Load on my nHibernate session object, how do I specify what sort order to apply to the results?


Top
 Profile  
 
 Post subject: Re: sorting on Session Load call
PostPosted: Wed Feb 28, 2007 2:16 am 
Regular
Regular

Joined: Sun Jan 21, 2007 4:33 pm
Posts: 65
omatase wrote:
Hibernate version: 1.2.0 Beta 2

When I call Load on my nHibernate session object, how do I specify what sort order to apply to the results?


The sort method (overloaded if needbe) of the type you are calling them as?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 28, 2007 3:29 am 
Senior
Senior

Joined: Mon Aug 21, 2006 9:18 am
Posts: 179
'Load' only brings in a single object, so I don't understand what you want to sort. If you mean sorting a collection of objects...

Code:
public ICollection<T> Load(params Order[] orders)
{
       ICriteria crit = Session.CreateCriteria(typeof (T));

       foreach(Order ord in orders)
      {
          crit.AddOrder(ord);
       }
       return crit.List();
}


Is that what you are looking for?

MIKE[/code]

_________________
If this helped...please remember to rate it!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 28, 2007 12:01 pm 
Beginner
Beginner

Joined: Mon Oct 02, 2006 6:46 pm
Posts: 32
that's exactly what I needed. Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.