diff --git a/extensions/spring-data-jpa/deployment/src/test/java/io/quarkus/spring/data/deployment/ModifyingQueryWithFlushAndClearTest.java b/extensions/spring-data-jpa/deployment/src/test/java/io/quarkus/spring/data/deployment/ModifyingQueryWithFlushAndClearTest.java index 4c3a98c3b7af5..165963c28cabe 100644 --- a/extensions/spring-data-jpa/deployment/src/test/java/io/quarkus/spring/data/deployment/ModifyingQueryWithFlushAndClearTest.java +++ b/extensions/spring-data-jpa/deployment/src/test/java/io/quarkus/spring/data/deployment/ModifyingQueryWithFlushAndClearTest.java @@ -33,6 +33,7 @@ public class ModifyingQueryWithFlushAndClearTest { public void setUp() { final User user = getUser("JOHN"); user.setLoginCounter(0); + user.getLoginEvents().clear(); repo.save(user); } @@ -69,8 +70,9 @@ public void testNoAutoFlush() { final User verifyUser = getUser("JOHN"); // processLoginEvents did not see the new login event + assertThat(verifyUser.getLoginEvents()).hasSize(1); final boolean allProcessed = verifyUser.getLoginEvents().stream() - .allMatch(loginEvent -> loginEvent.isProcessed()); + .allMatch(LoginEvent::isProcessed); assertThat(allProcessed).describedAs("all LoginEvents are marked as processed").isFalse(); } @@ -83,8 +85,9 @@ public void testAutoFlush() { repo.processLoginEventsPlainAutoClearAndFlush(); final User verifyUser = getUser("JOHN"); + assertThat(verifyUser.getLoginEvents()).hasSize(1); final boolean allProcessed = verifyUser.getLoginEvents().stream() - .allMatch(loginEvent -> loginEvent.isProcessed()); + .allMatch(LoginEvent::isProcessed); assertThat(allProcessed).describedAs("all LoginEvents are marked as processed").isTrue(); } diff --git a/extensions/spring-data-jpa/runtime/src/main/java/io/quarkus/spring/data/runtime/RepositorySupport.java b/extensions/spring-data-jpa/runtime/src/main/java/io/quarkus/spring/data/runtime/RepositorySupport.java index 64daa3dceb133..f6c26e52be9c9 100644 --- a/extensions/spring-data-jpa/runtime/src/main/java/io/quarkus/spring/data/runtime/RepositorySupport.java +++ b/extensions/spring-data-jpa/runtime/src/main/java/io/quarkus/spring/data/runtime/RepositorySupport.java @@ -78,6 +78,6 @@ public static void clear(Class clazz) { } public static void flush(Class clazz) { - Panache.getSession(clazz).clear(); + Panache.getSession(clazz).flush(); } }