Java 休眠条件按最后一个id连接顺序
我需要一个货币列表,其中只包含货币历史记录的最后一个值,在sql中,此查询有效:Java 休眠条件按最后一个id连接顺序,java,sql,hibernate,hibernate-criteria,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
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条件中执行此操作?在执行查询/条件之前,按id DESC执行
排序并限制结果数。我需要一个结果列表以放入数据表中,我无法限制结果。