-->
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.  [ 7 posts ] 
Author Message
 Post subject: SYSDATE
PostPosted: Thu Feb 19, 2004 11:48 am 
Newbie

Joined: Thu Dec 04, 2003 3:45 pm
Posts: 9
Hi,

Here is my HQL-Query and the translated SQL as well:
Code:
2004-02-19 16:41:36,964 DEBUG [net.sf.hibernate.hql.QueryTranslator] HQL: SELECT ctv.id, ctv.name FROM ChannelTreeVersion AS ctv WHERE ctv.activationDate <= [b]SYSDATE[/b] and ctv.activationDate in   (SELECT max(ctv1.activationDate)   FROM bbt.cn.core.bo.ChannelTreeVersion as ctv1   WHERE ctv1.activationDate <= [b]SYSDATE[/b]) GROUP BY ctv.id, ctv.name
2004-02-19 16:41:36,964 DEBUG [net.sf.hibernate.hql.QueryTranslator] SQL: select channeltre0_.CTV_ID as x0_0_, channeltre0_.CTV_NAME as x1_0_ from CHANNELTREEVERSION channeltre0_ where (channeltre0_.CTV_ACTIVATIONDATE<=[b]SYSDATE[/b] )and(channeltre0_.CTV_ACTIVATIONDATE in(select max(channeltre1_.CTV_ACTIVATIONDATE) from CHANNELTREEVERSION channeltre1_ where (channeltre1_.CTV_ACTIVATIONDATE<=[b]SYSDATE[/b] ))) group by  channeltre0_.CTV_ID , channeltre0_.CTV_NAME


I am using the PostgreSQL-DB and therefore it should replace SYSDATE with either CURRENT_DATE or CURRENT_TIMESTAMP!

The other things worked just fine!

best regards,
gimi


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 11:56 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Why do you thing Hibernate should replace SYSDATE with current_date by default?

Use something like hibernate.query.substitutions to configure such substitutions.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 12:01 pm 
Newbie

Joined: Thu Dec 04, 2003 3:45 pm
Posts: 9
gloeglm wrote:
Why do you thing Hibernate should replace SYSDATE with current_date by default?

Use something like hibernate.query.substitutions to configure such substitutions.


I don't think it should do it by default, but till I am using PostgreSQL-Dialect, it should replace SYSDTATE because SYSDATE is not a valid function in PostgreSQL! And I think that's one reason why I use HQL!

regards,
gimi


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 12:06 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
That is not supported! Supporting some common SQL Functions and Keywords across Dialects is considered for future versions! Also you should properly learn about not using ! after every sentence!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 12:27 pm 
Newbie

Joined: Thu Dec 04, 2003 3:45 pm
Posts: 9
gloeglm wrote:
That is not supported! Supporting some common SQL Functions and Keywords across Dialects is considered for future versions! Also you should properly learn about not using ! after every sentence!


okey gloeglm,

thanks for the answer and also thank for the advice. it's a bad habit of mine :-)
I used hibernate.query.substitutions SYSDATE=CURRENT_TIMESTAMP and now it works.

regards,
gimi


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 12:30 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
There is currently work on the way for a new HQL Parser which will hopefully make adding such things easier, so you might see things like current_date() in HQL which is translated to the database specific functions in the future.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 20, 2004 12:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Quote:
might see things like current_date() in HQL


Note that that would simply be a hibernate extension to standard JDBC sql extensions (extnsion of extensions, lol).

And actually that functionality is already available via accessing the sql extension functions from the HQL:
SELECT ctv.id, ctv.name FROM ChannelTreeVersion AS ctv WHERE ctv.activationDate <= {fn NOW()}


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