File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
spring-data-jpa/src/main/java/org/springframework/data/jpa/repository Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 1515 */
1616package org .springframework .data .jpa .repository ;
1717
18+ import jakarta .persistence .criteria .CriteriaBuilder ;
19+ import jakarta .persistence .criteria .CriteriaQuery ;
20+ import jakarta .persistence .criteria .Root ;
21+
1822import java .util .List ;
1923import java .util .Optional ;
2024import java .util .function .Function ;
@@ -89,6 +93,14 @@ public interface JpaSpecificationExecutor<T> {
8993
9094 /**
9195 * 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}.
92104 *
93105 * @param spec the {@link Specification} to use for the existence check, must not be {@literal null}.
94106 * @return the number of entities deleted.
You can’t perform that action at this time.
0 commit comments