-->
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: Criteria addOrder problem
PostPosted: Tue Sep 21, 2004 1:40 pm 
Newbie

Joined: Tue Jul 06, 2004 4:40 am
Posts: 9
Location: Slovakia
I have a problem with order of result created by Criteria.list(),
the result is ordered by ID, and I wish to order it by something else.
Is it possible?

Code:
Criteria crit = HibernateProvider.getSession().createCriteria( Object1.class);   
crit.addOrder( Order.asc( "object2"));      
List list = crit.list();


Object1 mapping:
Code:
<many-to-one name="object2" class="sk.axonpro.plus.hibernate.Object2" column="object2_id" />


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 21, 2004 1:45 pm 
Newbie

Joined: Tue Jul 06, 2004 4:40 am
Posts: 9
Location: Slovakia
I wish to do something like this SQL:
Code:
select object1.title,  object1.object2_id, object2.title from object1, object2 where object1.object2_ID = object2.ID order by object2.title ;


order by object2.title - this is the problem - how to create this order in Hibernate...


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.