Retain element ordering in entity callbacks.

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 #777
This commit is contained in:
Mark Paluch
2022-08-16 11:19:44 +02:00
parent 39216db553
commit dd2d94e2bd

View File

@@ -409,7 +409,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,
@@ -1114,7 +1114,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));
}
}