views:

1042

answers:

1

How can i get DATEPART of a time using HQL or Criteria ? I have googled it up and get some tips, but wasn't enough. If there is someone who has experienced it before, please let us know.

Thanks in advance

+1  A: 

Take a look at this post about using sql functions in nhibernate from ayende.

EDIT I have had success with something like this in the configuration file :

<property name="query.substitutions">
   true 1, false 0, yes 'Y', no 'N',getdate=getdate
</property>

notice the getdate=getdate, not sure how recommended this is but it is using the sql function :).

More on this : http://www.hibernate.org/hib_docs/nhibernate/html/session-configuration.html , search for query.substitutions.

sirrocco
Thank you,I will check it as soon as possible
Barbaros Alp