Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 休眠条件按最后一个id连接顺序_Java_Sql_Hibernate_Hibernate Criteria - Fatal编程技术网

Java 休眠条件按最后一个id连接顺序

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_, (

我需要一个货币列表,其中只包含货币历史记录的最后一个值,在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条件中执行此操作?

在执行查询/条件之前,按id DESC执行
排序并限制结果数。我需要一个结果列表以放入数据表中,我无法限制结果。