Retain element ordering in AfterConvertCallbacks.

We now use concatMap on result Fluxes to retain the object order. Previously, we used flatMap on a flux that has led to changes in element ordering.

Closes #1307
This commit is contained in:
Mark Paluch
2022-08-16 11:21:07 +02:00
parent e246cc4f59
commit 92e77a47c9

View File

@@ -380,7 +380,7 @@ public class R2dbcEntityTemplate implements R2dbcEntityOperations, BeanFactoryAw
return (P) ((Mono<?>) result).flatMap(it -> maybeCallAfterConvert(it, tableName));
}
return (P) ((Flux<?>) result).flatMap(it -> maybeCallAfterConvert(it, tableName));
return (P) ((Flux<?>) result).concatMap(it -> maybeCallAfterConvert(it, tableName));
}
private <T> RowsFetchSpec<T> doSelect(Query query, Class<?> entityClass, SqlIdentifier tableName,
@@ -942,7 +942,7 @@ public class R2dbcEntityTemplate implements R2dbcEntityOperations, BeanFactoryAw
@Override
public Flux<T> all() {
return delegate.all().flatMap(it -> maybeCallAfterConvert(it, tableName));
return delegate.all().concatMap(it -> maybeCallAfterConvert(it, tableName));
}
}