-->
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: Hibernate Criteria Order By Case When Issue
PostPosted: Mon Dec 27, 2010 7:06 pm 
Newbie

Joined: Mon May 03, 2010 6:36 pm
Posts: 5
Hi

I'm new to Hibernate and posted this question in another forum, but haven't got any solution. Sorry for the cross posting.

My issue is to order addresses by a particular state (Maryland) and then show all other states after that. I was able to get he SQL from the other post. I want an equivalent of this SQL in Hibernate using Criteria API

Code:
select * from prsn_addr  where ...
order by case when usps_state_cd = 'MD' then 0 else 1 end,usps_state_cd



The output I want is to show the addresses in MD first and then show all other after that. One of the responses was in nHibernate, but it is not working for me as we use Java. Also got a response with HQL, but want to try with criteria first. If anyone can help me out here in the right direction, that would be awesome



Thanks

Harish


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.