diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/RepositoryItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/RepositoryItemReader.java index 4494b2d8c..d44af4eda 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/RepositoryItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/RepositoryItemReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,7 +117,9 @@ public class RepositoryItemReader extends AbstractItemCountingItemStreamItemR } /** - * Provides ordering of the results so that order is maintained between paged queries + * Provides ordering of the results so that order is maintained between paged queries. + * Use a {@link java.util.LinkedHashMap} in case of multiple sort entries to keep the + * order. * @param sorts the fields to sort by and the directions */ public void setSort(Map sorts) { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/RepositoryItemReaderBuilder.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/RepositoryItemReaderBuilder.java index e90a21f0e..8b5167967 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/RepositoryItemReaderBuilder.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/RepositoryItemReaderBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -130,6 +130,8 @@ public class RepositoryItemReaderBuilder { /** * Provides ordering of the results so that order is maintained between paged queries. + * Use a {@link java.util.LinkedHashMap} in case of multiple sort entries to keep the + * order. * @param sorts the fields to sort by and the directions. * @return The current instance of the builder. * @see RepositoryItemReader#setSort(Map)