-->
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.  [ 1 post ] 
Author Message
 Post subject: How do I get the time-part from a date in Expression.between
PostPosted: Fri Oct 27, 2006 5:27 am 
Newbie

Joined: Fri Oct 27, 2006 5:10 am
Posts: 2
Hibernate version: 3.2.0

Name and version of the database you are using: Oracle 10.2

I have a table with events. In that table there is a date column. In there the date and time is stored when the event has happened. Now I want to get all the events that happened between 10:00 and 12:00 on any day.

I try to do this by creating a Criteria.

Code:
    Criteria  criteria        = createCriteria();
    criteria.add(Expression.between("extract(hour from {alias}.EVENT_DATE)",
                                    startMorning, endMorning);


startMorning and endMorning are 2 Long variables that contain the time in milliseconds. What do I need to put in the place of hour in the extract function or is there a better way to get to the result?

Thanks in advance,

Marco


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.