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 object equivalent?
PostPosted: Tue Nov 23, 2010 4:18 pm 
Newbie

Joined: Tue Nov 23, 2010 12:30 pm
Posts: 2
Hi.

I have 2 tables:

groupInfo table
================================================
group_name, sort_direction(ASC, DESC), description


groupData table
================================================
short_name, long_name, group_name, sort_order

I want to make 1 database call.
The user will provide the sort direction. however if the sort_direction is not provided I want to use the value that is set up for that group in the database.
I am able to achieve this using the following sql statement (notice the order by subselect)

Code:
select short_name, long_name, sort_direction
from groupInfo gd, groupData gdg
where gd.group_name='StreetType' and gd.GROUP_NAME=gdg.GROUP_NAME
order by
(select short_name || sort_direction from groupInfo where group_name='StreetType');


Is there a way to create this order by subselect statement using a Criteria object?
groupValues.addOrder(....)?

Thanks

M


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.