Polishing.

Original pull request #1229
This commit is contained in:
Jens Schauder
2022-06-01 14:48:11 +02:00
parent aa1610d381
commit cf6e174088
3 changed files with 5 additions and 5 deletions

View File

@@ -203,6 +203,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy {
.getRequiredPersistentEntity(propertyPath.getBaseProperty().getOwner().getType());
RelationalPersistentProperty referencingProperty = propertyPath.getLeafProperty();
Assert.notNull(referencingProperty, "No property found matching the PropertyPath " + propertyPath);
String delete = sql(rootEntity.getType()).createDeleteInByPath(propertyPath);

View File

@@ -379,6 +379,7 @@ class SqlGenerator {
* @return the statement as a {@link String}. Guaranteed to be not {@literal null}.
*/
String createDeleteInByPath(PersistentPropertyPath<RelationalPersistentProperty> path) {
return createDeleteByPathAndCriteria(new PersistentPropertyPathExtension(mappingContext, path),
filterColumn -> filterColumn.in(getBindMarker(IDS_SQL_PARAMETER)));
}

View File

@@ -51,8 +51,7 @@ public class SaveBatchingAggregateChange<T> implements BatchingAggregateChange<T
private final List<DbAction.InsertRoot<T>> insertRootBatchCandidates = new ArrayList<>();
private final Map<PersistentPropertyPath<RelationalPersistentProperty>, Map<IdValueSource, List<DbAction.Insert<Object>>>> insertActions = //
new HashMap<>();
private final Map<PersistentPropertyPath<RelationalPersistentProperty>, List<DbAction.Delete<Object>>> deleteActions = //
new HashMap<>();
private final Map<PersistentPropertyPath<RelationalPersistentProperty>, List<DbAction.Delete<Object>>> deleteActions = new HashMap<>();
SaveBatchingAggregateChange(Class<T> entityType) {
this.entityType = entityType;
@@ -88,9 +87,8 @@ public class SaveBatchingAggregateChange<T> implements BatchingAggregateChange<T
deletes.forEach(consumer);
}
});
insertActions.entrySet().stream().sorted(Map.Entry.comparingByKey(pathLengthComparator))
.forEach((entry) -> entry.getValue().forEach((idValueSource, inserts) ->
consumer.accept(new DbAction.BatchInsert<>(inserts))));
insertActions.entrySet().stream().sorted(Map.Entry.comparingByKey(pathLengthComparator)).forEach((entry) -> entry
.getValue().forEach((idValueSource, inserts) -> consumer.accept(new DbAction.BatchInsert<>(inserts))));
}
@Override