2

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

提前致谢

4

1 回答 1

2

看看这篇关于在ayende的 nhibernate 中使用 sql 函数的帖子。

编辑我在配置文件中取得了这样的成功:

<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。

于 2009-01-12T15:16:06.617 回答