Hibernate Criteria按最后一个id加入订单

时间:2013-05-28 19:33:27

标签: java sql hibernate hibernate-criteria

我需要一个只包含货币历史记录最后值的货币列表,在这个查询的sql中运行:

    select
      this_.name as y2_,
      this_.id as y3_,
      this_.currency as y4_,
      (select currency_value from currency_history where currency_id = this_.id order by id desc limit 1) as y5_,
      (select date_register from currency_history where currency_id = this_.id order by id desc limit 1) as y6_
  from
      currency this_ 

我如何才能在Hibernate Criteria中使用它?

0 个答案:

没有答案