在HQL或条件中获取DATEPART? [英] Getting DATEPART in HQL or Criteria?

查看:91
本文介绍了在HQL或条件中获取DATEPART?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用HQL或Criteria获得某个时间的DATEPART? 我已经用谷歌搜索并获得了一些提示,但是还不够. 如果有人曾经经历过,请告诉我们.

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.

预先感谢

推荐答案

看看有关 编辑,我在配置文件中成功完成了类似的事情:

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>

注意getdate = getdate,不确定如何推荐,但是它使用的是sql函数:).

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

有关此内容的更多信息: http://www.hibernate.org /hib_docs/nhibernate/html/session-configuration.html ,搜索query.substitutions.

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

这篇关于在HQL或条件中获取DATEPART?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆