File tree 1 file changed +12
-0
lines changed
spring-data-jpa/src/main/java/org/springframework/data/jpa/repository
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 15
15
*/
16
16
package org .springframework .data .jpa .repository ;
17
17
18
+ import jakarta .persistence .criteria .CriteriaBuilder ;
19
+ import jakarta .persistence .criteria .CriteriaQuery ;
20
+ import jakarta .persistence .criteria .Root ;
21
+
18
22
import java .util .List ;
19
23
import java .util .Optional ;
20
24
import java .util .function .Function ;
@@ -89,6 +93,14 @@ public interface JpaSpecificationExecutor<T> {
89
93
90
94
/**
91
95
* Deletes by the {@link Specification} and returns the number of rows deleted.
96
+ * <p>
97
+ * This method uses {@link jakarta.persistence.criteria.CriteriaDelete Criteria API bulk delete} that maps directly to
98
+ * database delete operations. The persistence context is not synchronized with the result of the bulk delete.
99
+ * <p>
100
+ * Please note that {@link jakarta.persistence.criteria.CriteriaQuery} in,
101
+ * {@link Specification#toPredicate(Root, CriteriaQuery, CriteriaBuilder)} will be {@literal null} because
102
+ * {@link jakarta.persistence.criteria.CriteriaBuilder#createCriteriaDelete(Class)} does not implement
103
+ * {@code CriteriaQuery}.
92
104
*
93
105
* @param spec the {@link Specification} to use for the existence check, must not be {@literal null}.
94
106
* @return the number of entities deleted.
You can’t perform that action at this time.
0 commit comments