-->
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.  [ 3 posts ] 
Author Message
 Post subject: ordering query dynamicly
PostPosted: Tue Dec 13, 2005 9:49 am 
Newbie

Joined: Tue Dec 13, 2005 9:40 am
Posts: 2
Hi,
I have a simple query string like
"from Customer as cust join Cars as car where car.id = cust.carId"
I need a way of adding order by dynamicly, so I can generate queries like this:
"from Customer as cust join Cars as car where car.id = cust.carId order by cust.id" or
"from Customer as cust join Cars as car where car.id = cust.carId order by car.name" and so on...
But, I can't use filters, and I don't want to parse the text of the query,
In other words I need a way to get a mapping from the resulting fields and the source fields. example:
field1 -> cust.name
field2 -> cust.id
field3 -> car.id
field4 -> car.name
...

thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 13, 2005 10:57 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
using Criteria with H3 you can build queries dynamically.

I'm not sure what that last bit meant
Quote:
In other words I need a way to get a mapping from the resulting fields and the source fields...

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 13, 2005 11:10 am 
Newbie

Joined: Tue Dec 13, 2005 9:40 am
Posts: 2
I can not use criteria.
What I mean is:
if the resulting type lokks like:
public class Customer{
String firstName
String lastName
....
}

I need to know what is the field name/alias in the quey string that the Customer.firstName is taken from. For eample cust.fName in case of the folowing query: "from Customer as cust where cust.lastName='me' "


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.