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: Beteween clause
PostPosted: Mon Jun 05, 2006 7:57 am 
Newbie

Joined: Wed Apr 27, 2005 5:03 am
Posts: 10
Hi all,

I am writing a sample HQL query .

FROM User user where user.createdDate between '2006-04-24' AND '2006-05-18'


I am not getting any result .

Is theere anything wrong in the query?




Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

[b]Hibernate version:[/b]

[b]Mapping documents:[/b]

[b]Code between sessionFactory.openSession() and session.close():[/b]

[b]Full stack trace of any exception that occurs:[/b]

[b]Name and version of the database you are using:[/b]

[b]The generated SQL (show_sql=true):[/b]

[b]Debug level Hibernate log excerpt:[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 05, 2006 11:49 am 
Expert
Expert

Joined: Thu Sep 22, 2005 10:29 am
Posts: 285
Location: Almassera/Valencia/Spain/EU/Earth/Solar system/Milky Way/Local Group/Virgo Supercluster
Code:
      Calendar calendar = new GregorianCalendar();
      calendar.set(2006, 4, 24);
      Date begin = calendar.getTime();
      calendar.set(2006, 5, 18);
      Date end = calendar.getTime();
      String hql = "from User as user where user.createdDate between :begin and :end";
      List users = session.createQuery(hql)
      .setDate("begin", begin)
      .setDate("end", end)
      .list();


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