-->
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: sort problem in hibernate 2.0
PostPosted: Mon Jul 16, 2007 12:25 pm 
Newbie

Joined: Wed Dec 27, 2006 2:25 am
Posts: 9
Location: Chennai-India
In my project, I used Hibernate2.0 with struts framework.
In hibernate2.0, I used to get the records by using Criteria.
Now I have a problem in sorting.

For example,
private abstract class Book
{
Integer bookId;
String bookName;
}
private abstract class customer
{
Integer customerId;
String customerName;
Book cusomerBookId;
}


In this example,if I want to sort by customerId,customerName, I use

criteria.addOrder(Order.asc(customerId));
criteria.addOrder(Order.asc(customerName));

When I would like to sort by using book Name, I use
criteria.addOrder(Order.asc(cusomerBookId.bookName));

It does not sort,Rather If I give
criteria.addOrder(Order.asc(cusomerBookId));

Like that, then It sorts by bookId

Now How to sort by cusomerBookId.bookName. Is it possible to sort like that?
If possibe how to do it? Kindly explain me.


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.