Browse Source

Retain element ordering in `AfterConvertCallback`s.

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
pull/1319/head
Mark Paluch 3 years ago
parent
commit
92e77a47c9
No known key found for this signature in database
GPG Key ID: 4406B84C1661DCD1
  1. 4
      spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/core/R2dbcEntityTemplate.java

4
spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/core/R2dbcEntityTemplate.java

@ -380,7 +380,7 @@ public class R2dbcEntityTemplate implements R2dbcEntityOperations, BeanFactoryAw @@ -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 @@ -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));
}
}

Loading…
Cancel
Save