-->
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.  [ 4 posts ] 
Author Message
 Post subject: HQL for selecting date only from timestamp column
PostPosted: Tue Jun 08, 2004 1:00 am 
Newbie

Joined: Mon Jan 12, 2004 2:24 am
Posts: 16
Hi all,

I have the following entry in my Registration.hbm.xml:
<property name="visitDate" type="timestamp">
<column name="visit_date" not-null="false"/>
</property>

As you can see, the visitDate's type is timestamp, i.e it has
hh:mm:ss in addition of standard Date properties.

Then I want to selecting record from my registration whose
visitDate match a specific date (without timestamp), for example, Jun 8, 2004, so records like June 8, 2004, 13:45 will be selected.

Can anybody tell me the best way to do that in HQL?
I'm using Hibernate 2.1.2 and database Oracle 9i
Thanks very much in advance

_________________
~Dion


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 08, 2004 1:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Code:
select to_date(x.visitDate) from X x


You probably need to upgrade to 2.1.4.


Top
 Profile  
 
 Post subject: to_date works! thanks a lot!
PostPosted: Wed Jun 09, 2004 7:41 am 
Newbie

Joined: Mon Jan 12, 2004 2:24 am
Posts: 16
Gavin,
It works. In fact, I've tried in version 2.1.2, and it works as well.
Thanks a lot for that, and thanks a lot for you & friends for giving us such a great stuff!!!

I was wondering, where or in what doc can I find the list of hibernate features like that? Can't find it in the hibernate_reference.pdf.

_________________
~Dion


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 09, 2004 7:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Read the source luke.

This is a dialect specific feature - 2.1.4 include more db functions in the various dialects. Its currently not documented.


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