From 89db774509c2f4e5f6c447f8a168fe37fe89b594 Mon Sep 17 00:00:00 2001 From: Faraz <58445945+farazahmadk@users.noreply.github.com> Date: Mon, 9 Oct 2023 23:31:35 +0200 Subject: [PATCH] Update Javadoc regarding sort order in RepositoryItemReader Issue #4462 --- .../batch/item/data/RepositoryItemReader.java | 6 ++++-- .../item/data/builder/RepositoryItemReaderBuilder.java | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) 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)