-->
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: date comparison in HQL
PostPosted: Mon Jul 02, 2007 1:41 pm 
Beginner
Beginner

Joined: Tue Dec 28, 2004 11:30 am
Posts: 32
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.2
Mapping documents:

A quick question about doing an hql search with date.

My hql query

Code:
from Test where test.date = ?

parameter = new Date("7/2/2007")


This is not returning the expected row. What am I doing wrong


Top
 Profile  
 
 Post subject: Re: date comparison in HQL
PostPosted: Mon Jul 02, 2007 3:23 pm 
Beginner
Beginner

Joined: Fri Apr 13, 2007 9:27 am
Posts: 33
kkrikor wrote:
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.2
Mapping documents:

A quick question about doing an hql search with date.

My hql query

Code:
from Test where test.date = ?

parameter = new Date("7/2/2007")


This is not returning the expected row. What am I doing wrong


try this syntax

String hql = "from Test t where t.date = :date";

query = hibernateSession.createQuery(hql);
query.setParameter("date", new Date("7/2/2007");


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 03, 2007 8:30 am 
Beginner
Beginner

Joined: Tue Dec 28, 2004 11:30 am
Posts: 32
Found the error was putting the query in a LOWER() function. Once i took that out all was good

Thanks


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.