【发布时间】:2009-01-12 14:52:47
【问题描述】:
如何使用 HQL 或 Criteria 获取 DATEPART 时间? 我已经用谷歌搜索了它并获得了一些提示,但还不够。 如果有人之前经历过,请告诉我们。
提前致谢
【问题讨论】:
标签: nhibernate datetime hql criteria
如何使用 HQL 或 Criteria 获取 DATEPART 时间? 我已经用谷歌搜索了它并获得了一些提示,但还不够。 如果有人之前经历过,请告诉我们。
提前致谢
【问题讨论】:
标签: nhibernate datetime hql criteria
看看这篇来自ayende的关于using sql functions in nhibernate的帖子。
编辑我在配置文件中成功使用了类似的东西:
<property name="query.substitutions">
true 1, false 0, yes 'Y', no 'N',getdate=getdate
</property>
注意getdate=getdate,不知道这是如何推荐的,但它使用的是sql函数:)。
更多信息:http://www.hibernate.org/hib_docs/nhibernate/html/session-configuration.html,搜索 query.substitutions。
【讨论】: