-->
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.  [ 6 posts ] 
Author Message
 Post subject: Query between data ranges
PostPosted: Wed Jul 21, 2004 6:40 pm 
Newbie

Joined: Tue Oct 21, 2003 6:14 pm
Posts: 11
I am using the Query interface to find objects between a given data range,

"from ObjectA oa where oa.lastModifiedDate >= ? and oa.lastModifiedDatae <=?

Where I am dynamically binding the date values. It works fine except when both the start and end date or the same date but different times.

I looked at the query and it has the 00:00:000 ( hr:min;sec) value for both even though the actual date has the right hr:min:sec on it
( 'Jul 21 2004 12:00:00:000AM', 'Jul 21 2004 12:00:00:000AM', )

Is there some setting/date format I have to do have hr:min:sec included?

thanks
Rama


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 21, 2004 7:50 pm 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
Can you post the code where you actually bind the values? I'm thinking you might be using a datatype that is scrapping the time.


Top
 Profile  
 
 Post subject: test
PostPosted: Wed Jul 21, 2004 11:15 pm 
Newbie

Joined: Thu Aug 28, 2003 11:19 pm
Posts: 17
test


Top
 Profile  
 
 Post subject: Here is the Code
PostPosted: Thu Jul 22, 2004 9:33 am 
Newbie

Joined: Tue Oct 21, 2003 6:14 pm
Posts: 11
This is the Query.
String query = "from A as cls where cls.lastModifiedDate>= ? and cls.lastModifiedDate <=?"

List valueList = new ArrayList();
List typeList = new ArrayList();

java.util.Date beginDate =....
java.util.Date endDate = ....
valueList.add(beginDate);
typeList.add(Hibernate.DATE);
valueList.add(endDate);
typeList.add(Hibernate.DATE);

List returnList = session.find(query,valueList,typeList);


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 02, 2004 9:42 pm 
Regular
Regular

Joined: Wed Jun 30, 2004 4:02 pm
Posts: 64
Did you ever find a solution to this problem?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 02, 2004 11:11 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
You want timestamp, not date


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