Skip to content

Commit 336ccdd

Browse files
dreab8DavideD
authored andcommitted
[#2737] MariaDB, mutation delete query does not delete an entity with joined inheritance
1 parent 82680a2 commit 336ccdd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/query/sqm/mutation/internal/temptable/ReactiveTableBasedDeleteHandler.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,12 @@ public CompletionStage<Integer> reactiveExecute(JdbcParameterBindings jdbcParame
9898

9999
private CompletionStage<Void> deleteRows(JdbcParameterBindings jdbcParameterBindings, StandardReactiveJdbcMutationExecutor jdbcMutationExecutor, SqmJdbcExecutionContextAdapter executionContext, int[] rows) {
100100
if ( getEntityDescriptor() instanceof UnionSubclassEntityPersister ) {
101-
return CompletionStages
102-
.loop( getDeletes(), delete -> reactiveExecute( jdbcParameterBindings, delete, jdbcMutationExecutor, executionContext )
101+
return loop( getDeletes(), delete -> reactiveExecute( jdbcParameterBindings, delete, jdbcMutationExecutor, executionContext )
103102
.thenApply( tot -> rows[0] += tot )
104103
);
105104
}
106105
else {
107-
return CompletionStages
108-
.loop( getDeletes(), delete -> reactiveExecute( jdbcParameterBindings, delete, jdbcMutationExecutor, executionContext )
106+
return loop( getDeletes(), delete -> reactiveExecute( jdbcParameterBindings, delete, jdbcMutationExecutor, executionContext )
109107
.thenApply( tot -> rows[0] = tot )
110108
);
111109
}
@@ -128,8 +126,10 @@ private CompletionStage<Integer> executeDelete(
128126
);
129127
}
130128
return loop( getCollectionTableDeletes(), delete ->
131-
reactiveExecute( jdbcParameterBindings, delete, jdbcMutationExecutor, executionContext )
132-
).thenApply( v -> rows );
129+
reactiveExecute( jdbcParameterBindings, delete, jdbcMutationExecutor, executionContext )
130+
).thenCompose( v -> loop( getDeletes(), delete ->
131+
reactiveExecute( jdbcParameterBindings, delete, jdbcMutationExecutor, executionContext )
132+
) ).thenApply( v -> rows );
133133
}
134134

135135
private static CompletionStage<Integer> reactiveExecute(

0 commit comments

Comments
 (0)