-->
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: current date in a portable way
PostPosted: Sun Aug 22, 2004 5:28 pm 
Newbie

Joined: Wed Jun 30, 2004 12:37 pm
Posts: 9
Hi,
Is it possible to write a HQL query that compares a field to the current date in a portable way ? For instance, the current date in Oracle is SYSDATE but it's NOW() in HSQLDB. This forces me to change the query when I change the data base which is annoying in my case.
Thanks in advance.
Hibernate version:2.1.6


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 22, 2004 5:34 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
you can do it in java ? more portable than the db...

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 22, 2004 7:52 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
hibernate.query.substitutions


By the way, most db now support the ANSI variation: current_date

However, I think Oracle9's current_date and current_timestamp are something "special", and have slightly diff semantics to the ANSI functions (not 100% on this though)

https://cwisdb.cc.kuleuven.ac.be/ora10d ... ons032.htm


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 23, 2004 5:56 pm 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
anthony wrote:
you can do it in java ? more portable than the db...


And safer in some environment where it is the 'application' time that matters and not the 'database' time...

Also very usefull to do it in Java when it comes to test the application - especialy features whose result depends on the current time ;)


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.