Skip to content

Commit 866668f

Browse files
committed
Provide deleted object to KeyValueTemplate instead of deleting entities by Id.
Closes #438
1 parent e8e8b23 commit 866668f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/main/java/org/springframework/data/keyvalue/repository/support/SimpleKeyValueRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public void delete(T entity) {
174174

175175
Assert.notNull(entity, "The given entity must not be null!");
176176

177-
deleteById(entityInformation.getRequiredId(entity));
177+
operations.delete(entity);
178178
}
179179

180180
/*

src/test/java/org/springframework/data/keyvalue/repository/SimpleKeyValueRepositoryUnitTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
* @author Christoph Strobl
4848
* @author Eugene Nikiforov
4949
* @author Jens Schauder
50+
* @author Mark Paluch
5051
*/
5152
@ExtendWith(MockitoExtension.class)
5253
class SimpleKeyValueRepositoryUnitTests {
@@ -108,7 +109,7 @@ void deleteEntity() {
108109
repo.save(one);
109110
repo.delete(one);
110111

111-
verify(opsMock, times(1)).delete(eq(one.getId()), eq(Foo.class));
112+
verify(opsMock, times(1)).delete(eq(one));
112113
}
113114

114115
@Test // DATACMNS-525

0 commit comments

Comments
 (0)