-->
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: Date Functions in Hibernate Query Language (HQL)
PostPosted: Wed Dec 01, 2004 12:29 pm 
Newbie

Joined: Tue Nov 30, 2004 2:37 pm
Posts: 16
Can anyone please tell whether HQL support any specific date functions or something.

I need to check for transactions between a date range (that can be done) and the document expiration date is greater than or equal to the transaction month. The document expiration date is a date column for eg., 11/01/2004, if this is the expiration date, the document expires at the end of the month (we cannot change the date, gotta use it this way). this only, I need to select transaction for a month, whose transaction date falls within the expiry period. basically I have to select like this.

trans.date between :startDate and :endDate
document.expirationDate's year value >= transaction startDate year document.expirationDate's month value >= transaction Start Date month like that. (how to do this?)

if you can give examples that would be great.

Kinda need this ASAP.

Can you please advice how to do date manipulations using HQL ?

Thanks a lot
SRK


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 01, 2004 1:14 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
All database-specific sql functions are just passed through by Hibernate, just use your normal old date functions like in SQL


Top
 Profile  
 
 Post subject: Date Functions in Hibernate Query Language (HQL)
PostPosted: Wed Dec 01, 2004 6:16 pm 
Newbie

Joined: Tue Nov 30, 2004 2:37 pm
Posts: 16
Thanks a lot. will do so.


Top
 Profile  
 
 Post subject: portable way / different external named queries for dialects
PostPosted: Thu Dec 23, 2004 5:21 am 
Newbie

Joined: Tue Mar 23, 2004 2:32 pm
Posts: 3
Is it possible to use date sql functions in a portable way (working across different SQL servers)?

I was wondering about externalizing such DB dependent SQL queries with incompatibile date functions using named queries in mapping files, but I have not found any possibility to write different queries for different DB dialects.

Am I missing something?

Regards,
Karel


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.