-->
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 query data using between fucntion for date???????
PostPosted: Tue Mar 07, 2006 7:20 pm 
Newbie

Joined: Mon Feb 06, 2006 12:25 am
Posts: 17
HI All,

I want to query the data based on date using between function
eg:

Code:
Select * FROM PROFILE_EVENT
WHERE TRUNC(EVENT_DATE_TIME) BETWEEN TO_DATE('02/21/2006','MM/dd/yyyy') AND TO_DATE('02/21/2006','MM/dd/yyyy')


when i execute this in oracle i am getting result.

when i execute this in hibernate i am getting no result.


hibernate generated query does not have trunc, to_date function.

Code:
Select * FROM PROFILE_EVENT
WHERE EVENT_DATE_TIME BETWEEN ? AND ?


how to query in hibernate??

thanks in advance
balag


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 08, 2006 3:49 pm 
Newbie

Joined: Mon Feb 06, 2006 12:25 am
Posts: 17
Anybody know how to do this??


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 24, 2006 5:02 pm 
Newbie

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 10
Location: Buenos Aires
i have the same question. i donĀ“t know how to use the to_char function of Oracle with HQL.


Top
 Profile  
 
 Post subject: Re: how to query data using between fucntion for date???????
PostPosted: Mon Jul 24, 2006 6:18 pm 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
balag wrote:
HI All,

I want to query the data based on date using between function
eg:

Code:
Select * FROM PROFILE_EVENT
WHERE TRUNC(EVENT_DATE_TIME) BETWEEN TO_DATE('02/21/2006','MM/dd/yyyy') AND TO_DATE('02/21/2006','MM/dd/yyyy')


when i execute this in oracle i am getting result.

when i execute this in hibernate i am getting no result.


hibernate generated query does not have trunc, to_date function.

Code:
Select * FROM PROFILE_EVENT
WHERE EVENT_DATE_TIME BETWEEN ? AND ?


how to query in hibernate??

thanks in advance
balag


I tried to execute the same query as you have and it worked for me. If you can post some more details like logs etc, it would be helpful. Once again try to check if you have dates in DB matching rhe values that you are passing in the query.


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.