diff --git a/pom.xml b/pom.xml
index 335f5969b8..ebb3a170b5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.springframework.data
spring-data-relational-parent
- 3.4.0-SNAPSHOT
+ 3.4.0-1623-return-lists-SNAPSHOT
pom
Spring Data Relational Parent
diff --git a/spring-data-jdbc-distribution/pom.xml b/spring-data-jdbc-distribution/pom.xml
index 84eeb178e0..3a145aec74 100644
--- a/spring-data-jdbc-distribution/pom.xml
+++ b/spring-data-jdbc-distribution/pom.xml
@@ -14,7 +14,7 @@
org.springframework.data
spring-data-relational-parent
- 3.4.0-SNAPSHOT
+ 3.4.0-1623-return-lists-SNAPSHOT
../pom.xml
diff --git a/spring-data-jdbc/pom.xml b/spring-data-jdbc/pom.xml
index 266af71b96..532c486740 100644
--- a/spring-data-jdbc/pom.xml
+++ b/spring-data-jdbc/pom.xml
@@ -6,7 +6,7 @@
4.0.0
spring-data-jdbc
- 3.4.0-SNAPSHOT
+ 3.4.0-1623-return-lists-SNAPSHOT
Spring Data JDBC
Spring Data module for JDBC repositories.
@@ -15,7 +15,7 @@
org.springframework.data
spring-data-relational-parent
- 3.4.0-SNAPSHOT
+ 3.4.0-1623-return-lists-SNAPSHOT
diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/JdbcAggregateOperations.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/JdbcAggregateOperations.java
index c0c9caf997..89d60baa39 100644
--- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/JdbcAggregateOperations.java
+++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/JdbcAggregateOperations.java
@@ -15,6 +15,7 @@
*/
package org.springframework.data.jdbc.core;
+import java.util.List;
import java.util.Optional;
import org.springframework.dao.IncorrectUpdateSemanticsDataAccessException;
@@ -58,7 +59,7 @@ public interface JdbcAggregateOperations {
* resulting update does not update any rows.
* @since 3.0
*/
- Iterable saveAll(Iterable instances);
+ List saveAll(Iterable instances);
/**
* Dedicated insert function. This skips the test if the aggregate root is new and makes an insert.
@@ -103,7 +104,7 @@ public interface JdbcAggregateOperations {
* @return the saved instances.
* @since 3.1
*/
- Iterable updateAll(Iterable instances);
+ List updateAll(Iterable instances);
/**
* Counts the number of aggregates of a given type.
@@ -162,7 +163,7 @@ public interface JdbcAggregateOperations {
* @param the type of the aggregate roots. Must not be {@code null}.
* @return Guaranteed to be not {@code null}.
*/
- Iterable findAllById(Iterable> ids, Class domainType);
+ List findAllById(Iterable> ids, Class domainType);
/**
* Load all aggregates of a given type.
@@ -171,7 +172,7 @@ public interface JdbcAggregateOperations {
* @param the type of the aggregate roots. Must not be {@code null}.
* @return Guaranteed to be not {@code null}.
*/
- Iterable findAll(Class domainType);
+ List findAll(Class domainType);
/**
* Load all aggregates of a given type, sorted.
@@ -182,7 +183,7 @@ public interface JdbcAggregateOperations {
* @return Guaranteed to be not {@code null}.
* @since 2.0
*/
- Iterable findAll(Class domainType, Sort sort);
+ List findAll(Class domainType, Sort sort);
/**
* Load a page of (potentially sorted) aggregates of a given type.
@@ -207,7 +208,7 @@ public interface JdbcAggregateOperations {
Optional findOne(Query query, Class domainType);
/**
- * Execute a {@code SELECT} query and convert the resulting items to a {@link Iterable} that is sorted.
+ * Execute a {@code SELECT} query and convert the resulting items to a {@link List} that is sorted.
*
* @param query must not be {@literal null}.
* @param domainType the entity type must not be {@literal null}.
@@ -215,7 +216,7 @@ public interface JdbcAggregateOperations {
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException if more than one match found.
* @since 3.0
*/
- Iterable findAll(Query query, Class domainType);
+ List findAll(Query query, Class domainType);
/**
* Returns a {@link Page} of entities matching the given {@link Query}. In case no match could be found, an empty
diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/JdbcAggregateTemplate.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/JdbcAggregateTemplate.java
index ad690dc273..dbef6d1e1a 100644
--- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/JdbcAggregateTemplate.java
+++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/JdbcAggregateTemplate.java
@@ -52,6 +52,7 @@
import org.springframework.data.relational.core.mapping.event.*;
import org.springframework.data.relational.core.query.Query;
import org.springframework.data.support.PageableExecutionUtils;
+import org.springframework.data.util.Streamable;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
@@ -171,7 +172,7 @@ public T save(T instance) {
}
@Override
- public Iterable saveAll(Iterable instances) {
+ public List saveAll(Iterable instances) {
Assert.notNull(instances, "Aggregate instances must not be null");
@@ -204,7 +205,7 @@ public T insert(T instance) {
}
@Override
- public Iterable insertAll(Iterable instances) {
+ public List insertAll(Iterable instances) {
Assert.notNull(instances, "Aggregate instances must not be null");
@@ -239,7 +240,7 @@ public T update(T instance) {
}
@Override
- public Iterable updateAll(Iterable instances) {
+ public List updateAll(Iterable instances) {
Assert.notNull(instances, "Aggregate instances must not be null");
@@ -298,7 +299,7 @@ public T findById(Object id, Class domainType) {
}
@Override
- public Iterable findAll(Class domainType, Sort sort) {
+ public List findAll(Class domainType, Sort sort) {
Assert.notNull(domainType, "Domain type must not be null");
@@ -323,8 +324,13 @@ public Optional findOne(Query query, Class domainType) {
}
@Override
- public Iterable findAll(Query query, Class domainType) {
- return accessStrategy.findAll(query, domainType);
+ public List findAll(Query query, Class domainType) {
+
+ Iterable all = accessStrategy.findAll(query, domainType);
+ if (all instanceof List list) {
+ return list;
+ }
+ return Streamable.of(all).toList();
}
@Override
@@ -337,7 +343,7 @@ public Page findAll(Query query, Class domainType, Pageable pageable)
}
@Override
- public Iterable findAll(Class domainType) {
+ public List findAll(Class domainType) {
Assert.notNull(domainType, "Domain type must not be null");
@@ -346,7 +352,7 @@ public Iterable findAll(Class domainType) {
}
@Override
- public Iterable findAllById(Iterable> ids, Class domainType) {
+ public List findAllById(Iterable> ids, Class domainType) {
Assert.notNull(ids, "Ids must not be null");
Assert.notNull(domainType, "Domain type must not be null");
@@ -607,7 +613,7 @@ private MutableAggregateChange> createDeletingChange(Class> domainType) {
return aggregateChange;
}
- private Iterable triggerAfterConvert(Iterable all) {
+ private List triggerAfterConvert(Iterable all) {
List result = new ArrayList<>();
diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/support/SimpleJdbcRepository.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/support/SimpleJdbcRepository.java
index 628c37afbf..08d4eb4f46 100644
--- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/support/SimpleJdbcRepository.java
+++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/support/SimpleJdbcRepository.java
@@ -15,6 +15,7 @@
*/
package org.springframework.data.jdbc.repository.support;
+import java.util.List;
import java.util.Optional;
import java.util.function.Function;
@@ -30,6 +31,7 @@
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.FluentQuery;
import org.springframework.data.repository.query.QueryByExampleExecutor;
+import org.springframework.data.util.Streamable;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
@@ -70,7 +72,7 @@ public S save(S instance) {
@Transactional
@Override
- public Iterable saveAll(Iterable entities) {
+ public List saveAll(Iterable entities) {
return entityOperations.saveAll(entities);
}
@@ -85,12 +87,12 @@ public boolean existsById(ID id) {
}
@Override
- public Iterable findAll() {
+ public List findAll() {
return entityOperations.findAll(entity.getType());
}
@Override
- public Iterable findAllById(Iterable ids) {
+ public List findAllById(Iterable ids) {
return entityOperations.findAllById(ids, entity.getType());
}
@@ -130,7 +132,7 @@ public void deleteAll() {
}
@Override
- public Iterable findAll(Sort sort) {
+ public List findAll(Sort sort) {
return entityOperations.findAll(entity.getType(), sort);
}
@@ -148,7 +150,7 @@ public Optional findOne(Example example) {
}
@Override
- public Iterable findAll(Example example) {
+ public List findAll(Example example) {
Assert.notNull(example, "Example must not be null");
@@ -156,7 +158,7 @@ public Iterable findAll(Example example) {
}
@Override
- public Iterable findAll(Example example, Sort sort) {
+ public List findAll(Example example, Sort sort) {
Assert.notNull(example, "Example must not be null");
Assert.notNull(sort, "Sort must not be null");
diff --git a/spring-data-r2dbc/pom.xml b/spring-data-r2dbc/pom.xml
index e335b56501..cf8a30a305 100644
--- a/spring-data-r2dbc/pom.xml
+++ b/spring-data-r2dbc/pom.xml
@@ -6,7 +6,7 @@
4.0.0
spring-data-r2dbc
- 3.4.0-SNAPSHOT
+ 3.4.0-1623-return-lists-SNAPSHOT
Spring Data R2DBC
Spring Data module for R2DBC
@@ -15,7 +15,7 @@
org.springframework.data
spring-data-relational-parent
- 3.4.0-SNAPSHOT
+ 3.4.0-1623-return-lists-SNAPSHOT
diff --git a/spring-data-relational/pom.xml b/spring-data-relational/pom.xml
index 6be1155d38..9bbdff0b54 100644
--- a/spring-data-relational/pom.xml
+++ b/spring-data-relational/pom.xml
@@ -6,7 +6,7 @@
4.0.0
spring-data-relational
- 3.4.0-SNAPSHOT
+ 3.4.0-1623-return-lists-SNAPSHOT
Spring Data Relational
Spring Data Relational support
@@ -14,7 +14,7 @@
org.springframework.data
spring-data-relational-parent
- 3.4.0-SNAPSHOT
+ 3.4.0-1623-return-lists-SNAPSHOT