-->
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: can you specify multiple Orders using addOrder for Criteria
PostPosted: Thu Jan 13, 2005 9:21 am 
Newbie

Joined: Thu Jan 13, 2005 9:04 am
Posts: 3
Using hibernate2.jar (dated 8/8/2004), no readme or version file in jar, not sure what the version is.

Database is Oracle

Generated sql is;
Hibernate: select 'some fields'... from atable_name where
some_criteria order by this.COLUMN_A asc

Code for order by is;
criteria.addOrder(Order.asc("columnA"));
criteria.addOrder(Order.desc("columnB"));

Problem;
Why isn't columnB appearing in the order by portion of the sql and don't tell me that you can only have one order by. If so the method is inappropriatley name and should be changed to setOrder.

Apologies for lack of hibernate version I did not set this up, so I am not sure what version was downloaded.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 13, 2005 5:05 pm 
Regular
Regular

Joined: Tue Jun 22, 2004 8:01 pm
Posts: 106
Location: PowderTown, Utah, USA
That's odd. I've dont that successfully many times, although I always chain them up liKe:

criteria.addOrder(Order.asc("columnA")).addOrder(Order.desc("columnB"));

Don't know if that makes a difference.

My advice: 1) turn on Hibernate logging and set it to debug level so you can see what it's doing. 2) Get jiggy with your debugger. You'll learn a lot more if you trace down into the hibernate code that's adding the order clause.


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.