如何使用 HQL 或 Criteria 获取时间的 DATEPART?
我用谷歌搜索并得到了一些提示,但还不够。
如果有人以前经历过,请告诉我们。
提前致谢
看看这篇关于在nhibernate中使用sql函数 http://ayende.com/Blog/archive/2006/10/01/UsingSQLFunctionsInNHibernate.aspx来自阿延德。
EDIT我在配置文件中成功地完成了类似的操作:
<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 http://www.hibernate.org/hib_docs/nhibernate/html/session-configuration.html,搜索 query.substitutions。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)