Skip to content

Commit b11fae8

Browse files
committed
Polishing.
See #3120
1 parent 4a46dbe commit b11fae8

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/SimpleJpaRepository.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,7 @@ public void deleteAllInBatch(Iterable<T> entities) {
266266
return;
267267
}
268268

269-
applyAndBind(getQueryString(DELETE_ALL_QUERY_STRING, entityInformation.getEntityName()), entities,
270-
entityManager)
269+
applyAndBind(getQueryString(DELETE_ALL_QUERY_STRING, entityInformation.getEntityName()), entities, entityManager)
271270
.executeUpdate();
272271
}
273272

@@ -305,7 +304,8 @@ public Optional<T> findById(ID id) {
305304
LockModeType type = metadata.getLockModeType();
306305
Map<String, Object> hints = getHints();
307306

308-
return Optional.ofNullable(type == null ? entityManager.find(domainType, id, hints) : entityManager.find(domainType, id, type, hints));
307+
return Optional.ofNullable(
308+
type == null ? entityManager.find(domainType, id, hints) : entityManager.find(domainType, id, type, hints));
309309
}
310310

311311
@Deprecated
@@ -484,17 +484,17 @@ public <S extends T> boolean exists(Example<S> example) {
484484
@Override
485485
public boolean exists(Specification<T> spec) {
486486

487-
CriteriaQuery<Integer> cq = this.em.getCriteriaBuilder().createQuery(Integer.class);
488-
cq.select(this.em.getCriteriaBuilder().literal(1));
487+
CriteriaQuery<Integer> cq = this.entityManager.getCriteriaBuilder().createQuery(Integer.class);
488+
cq.select(this.entityManager.getCriteriaBuilder().literal(1));
489489
applySpecificationToCriteria(spec, getDomainClass(), cq);
490-
TypedQuery<Integer> query = applyRepositoryMethodMetadata(this.em.createQuery(cq));
490+
TypedQuery<Integer> query = applyRepositoryMethodMetadata(this.entityManager.createQuery(cq));
491491
return query.setMaxResults(1).getResultList().size() == 1;
492492
}
493493

494494
@Override
495495
public long delete(Specification<T> spec) {
496496

497-
CriteriaBuilder builder = this.em.getCriteriaBuilder();
497+
CriteriaBuilder builder = this.entityManager.getCriteriaBuilder();
498498
CriteriaDelete<T> delete = builder.createCriteriaDelete(getDomainClass());
499499

500500
if (spec != null) {
@@ -505,7 +505,7 @@ public long delete(Specification<T> spec) {
505505
}
506506
}
507507

508-
return this.em.createQuery(delete).executeUpdate();
508+
return this.entityManager.createQuery(delete).executeUpdate();
509509
}
510510

511511
@Override
@@ -544,7 +544,7 @@ public <S extends T, R> R findBy(Example<S> example, Function<FetchableFluentQue
544544
};
545545

546546
FetchableFluentQuery<S> fluentQuery = new FetchableFluentQueryByExample<>(example, finder, this::count,
547-
this::exists, this.em, this.escapeCharacter);
547+
this::exists, this.entityManager, this.escapeCharacter);
548548

549549
return queryFunction.apply(fluentQuery);
550550
}
@@ -558,7 +558,7 @@ public <S extends T, R> R findBy(Specification<T> spec, Function<FetchableFluent
558558
Function<Sort, TypedQuery<T>> finder = sort -> getQuery(spec, getDomainClass(), sort);
559559

560560
FetchableFluentQuery<R> fluentQuery = new FetchableFluentQueryBySpecification<T, R>(spec, getDomainClass(),
561-
Sort.unsorted(), null, finder, this::count, this::exists, this.em);
561+
Sort.unsorted(), null, finder, this::count, this::exists, this.entityManager);
562562

563563
return queryFunction.apply((FetchableFluentQuery<S>) fluentQuery);
564564
}

0 commit comments

Comments
 (0)