From 2cd6d00de975eaf1ac4711271227ca84b1707a34 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Wed, 5 Jun 2024 15:34:09 +0200 Subject: [PATCH] Mark `delete(Specification)` as transactional method. Override readOnly to false. Closes #3499 --- .../data/jpa/repository/support/SimpleJpaRepository.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/SimpleJpaRepository.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/SimpleJpaRepository.java index bb7f7ee334..cbd6552b1f 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/SimpleJpaRepository.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/SimpleJpaRepository.java @@ -174,8 +174,8 @@ private String getCountQueryString() { return getQueryString(countQuery, entityInformation.getEntityName()); } - @Transactional @Override + @Transactional public void deleteById(ID id) { Assert.notNull(id, ID_MUST_NOT_BE_NULL); @@ -476,6 +476,7 @@ public boolean exists(Specification spec) { } @Override + @Transactional public long delete(Specification spec) { CriteriaBuilder builder = this.entityManager.getCriteriaBuilder();