Skip to content

Pass entity in repository delete(entity) and deleteAll(entities). #1726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void deleteById(ID id) {
@Override
public void delete(T entity) {
Assert.notNull(entity, "Entity must not be null!");
operations.removeById(getJavaType()).inScope(getScope()).inCollection(getCollection()).one(getId(entity));
operations.removeById(getJavaType()).inScope(getScope()).inCollection(getCollection()).oneEntity(entity);
}

@Override
Expand All @@ -125,7 +125,7 @@ public void deleteAllById(Iterable<? extends ID> ids) {
public void deleteAll(Iterable<? extends T> entities) {
Assert.notNull(entities, "The given Iterable of entities must not be null!");
operations.removeById(getJavaType()).inScope(getScope()).inCollection(getCollection())
.all(Streamable.of(entities).map(this::getId).toList());
.allEntities((Collection<Object>)Streamable.of(entities).toList());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void saveReplaceUpsertInsert() {
assertThrows(DuplicateKeyException.class, () -> userRepository.save(user));
user.setVersion(saveVersion + 1);
assertThrows(OptimisticLockingFailureException.class, () -> userRepository.save(user));
userRepository.delete(user);
userRepository.deleteById(user.getId());

// Airline does not have a version
Airline airline = new Airline(UUID.randomUUID().toString(), "MyAirline", null);
Expand Down