-->
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.  [ 2 posts ] 
Author Message
 Post subject: between clause using date
PostPosted: Tue Mar 16, 2004 10:19 am 
Newbie

Joined: Tue Mar 16, 2004 7:49 am
Posts: 1
    Hibernate version: 2.0.3
    MySQL version: 4.0.13-nt


Following is the hibernate query that I have:

Code:
query = session.createQuery("select requests from Request requests, Log log where log.request = requests and requests.requestType = :type and requests.userId = :userId and log.logTime.time between :startdate and :enddate and log.status = :status");


Following is the structure of the database table it uses:

Code:
cnet.Log
----------------------------

Field                    Type         
id                        varchar(32)
contentId       varchar(32)
logtime                [b]datetime[/b]
requestId             varchar(32)
status                  int(11)



The issue I have is that I set the startdate and enddate using java.util.Date, but I have zero Request objects returned from the query execution.

When I run the equivalent SQL query with the dates in the format '2004-03-15 00:00:00' and '2004-03-15 23:59:59', I get the desired values.

Could someone please throw some light on what the issue here might be. We are facing problems in manipulating the Date object for the Hibernate query so as to get the desired execution using the between clause.

Thanks,
/SAmith


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 16, 2004 10:48 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Are you using the correct setXXX methods?


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