【问题标题】:Translating to detachedCriteria转换为 detachedCriteria
【发布时间】:2011-06-19 07:20:58
【问题描述】:

如何将以下查询转换为 detachedCriteria:

select * from (
    select a.* ,row_number() over (partition by hotel_id order by  EXECUTION_START_DATE desc)  rnk  
    from HOLIDAY_PACKAGES a
)
where rnk = 1

【问题讨论】:

    标签: nhibernate detachedcriteria


    【解决方案1】:

    我认为您无法使用 Criteria API 构建这样的查询。唯一的方法是通过 Native SQL 支持,或者在最坏的情况下使用存储过程。

    http://www.nhforge.org/doc/nh/en/index.html#manipulatingdata-nativesql

    【讨论】:

    • 谢谢。我终于在数据库中使用了视图表并将其映射到一个对象
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多