-->
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.  [ 4 posts ] 
Author Message
 Post subject: how to use the result of date interval in HQL order by?
PostPosted: Tue Dec 21, 2010 3:47 am 
Newbie

Joined: Tue Dec 21, 2010 3:26 am
Posts: 2
I got this error in application:
Code:
could not resolve property: (current_date() - releaseDate)


releaseDate is a property in a OrdersValue.java.
in HQL, it tries to execute using order by (current_date() - releaseDate), I got this error.
Could someone tell me how to fix this issue, does hibernate allow us to use current_date() in order by clause? I saw in documentation, we can use it in where clause.
Or We must calculate it in java first then add it to HQL.
Thank you.


Top
 Profile  
 
 Post subject: Re: how to use the result of date interval in HQL order by?
PostPosted: Tue Dec 21, 2010 4:06 am 
Regular
Regular

Joined: Fri Nov 12, 2010 4:13 am
Posts: 81
Location: India
Quote:
I got this error in application:
Code:
could not resolve property: (current_date() - releaseDate)


Hibernate forms query according to mapping between entity class and mapping file.So if you will use (current_date() - releaseDate) in HQL query then (current_date() - releaseDate) property should be there in your bean class i.e. you should have getter setter method for (current_date() - releaseDate)

Maybe this will help you.


Chirag

_________________
Thanks & Regards,
Chirag


Top
 Profile  
 
 Post subject: Re: how to use the result of date interval in HQL order by?
PostPosted: Tue Dec 21, 2010 4:41 am 
Newbie

Joined: Tue Dec 21, 2010 3:26 am
Posts: 2
I know this error occured because of there is not a property in my value class.
But is there any other solutions that i don't need to change data structure?


Top
 Profile  
 
 Post subject: Re: how to use the result of date interval in HQL order by?
PostPosted: Tue Dec 21, 2010 4:46 am 
Regular
Regular

Joined: Fri Nov 12, 2010 4:13 am
Posts: 81
Location: India
Then you have to assign difference of (current_date() - releaseDate) to some entity class property and then add to HQL.

_________________
Thanks & Regards,
Chirag


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.