【问题标题】:Spring Batch JdbcPagingItemReader sort by two columns/keysSpring Batch JdbcPagingItemReader 按两列/键排序
【发布时间】:2021-09-12 22:38:30
【问题描述】:

我有这个 JdbcPagingItem 阅读器,我想按 2 列排序。

Map<String, Order> sortKey = new HashMap<>();
sortKey.put("xbin", Order.ASCENDING);
sortKey.put("ybin", Order.ASCENDING);

由于 sortKey 是一个 Map,我认为这应该可以工作。

如果我应该这样做,我需要一些确认吗?

谢谢,马库斯。

【问题讨论】:

    标签: spring-batch


    【解决方案1】:

    是的,您可以按多列对项目进行排序,并且您的代码 sn-p 是正确的。项目阅读器执行的查询结果将类似于:

    select ... from table .. ORDER BY xbin ASC, ybin ASC
    

    【讨论】:

      猜你喜欢
      • 2020-11-03
      • 2018-03-29
      • 2018-01-25
      • 1970-01-01
      • 2019-08-17
      • 1970-01-01
      • 1970-01-01
      • 2016-05-23
      • 1970-01-01
      相关资源
      最近更新 更多