Skip to content

Commit 91ee136

Browse files
committed
Fully consume insert response.
R2dbcEntityTemplate.insert(…) now fully consumes the response from the INSERT call before continuing. Previously, we consumed only the first signal and continued then. A driver could emit a row and then an error signal and so the error signal would go unnoticed. Closes #552.
1 parent 34d8d10 commit 91ee136

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/org/springframework/data/r2dbc/core/R2dbcEntityTemplate.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,8 @@ private <T> Mono<T> doInsert(T entity, SqlIdentifier tableName, OutboundRow outb
568568
return this.databaseClient.sql(operation) //
569569
.filter(statement -> statement.returnGeneratedValues())
570570
.map(this.dataAccessStrategy.getConverter().populateIdIfNecessary(entity)) //
571-
.first() //
572-
.defaultIfEmpty(entity) //
571+
.all() //
572+
.last(entity)
573573
.flatMap(saved -> maybeCallAfterSave(saved, outboundRow, tableName));
574574
}
575575

0 commit comments

Comments
 (0)