-->
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.  [ 2 posts ] 
Author Message
 Post subject: date functions
PostPosted: Sat Jul 23, 2005 1:15 pm 
Newbie

Joined: Wed May 18, 2005 8:56 am
Posts: 5
Location: tibro, sweden
Is there any date functions in NHibernate?

In sql i write my query like this
Code:
Select user from users where month(birthDate) = month(getDate()) and day(birthDate) = day(getDate())


How do i do that with NHibernate?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 27, 2005 3:10 am 
Regular
Regular

Joined: Tue Mar 15, 2005 12:38 pm
Posts: 73
Location: Bucharest
You can define your functions in the query.substitutions part of hibernate configuration.

Code:
<property name="hibernate.query.substitutions">true 1, false 0, month MONTH, DAY DAY, getDate GETDATE</property>


the code above should instruct nhibernate to replace any occurences of the word on left with the word on right.

What I'm not sure of is if the getdate function with no parameters will work, but remember is only available for single parameter functions.

Hope it helps.

PS: http://www.hibernate.org/hib_docs/reference/en/html/queryhql.html


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