【问题标题】:Getting DATEPART in HQL or Criteria?在 HQL 或标准中获取 DATEPART?
【发布时间】:2009-01-12 14:52:47
【问题描述】:

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

提前致谢

【问题讨论】:

    标签: nhibernate datetime hql criteria


    【解决方案1】:

    看看这篇来自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。

    【讨论】:

    • 谢谢,我会尽快查收的
    猜你喜欢
    • 2011-08-25
    • 2013-05-25
    • 2010-09-16
    • 1970-01-01
    • 1970-01-01
    • 2011-05-25
    • 2011-07-30
    • 1970-01-01
    相关资源
    最近更新 更多