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 728e06d34..ea9a80fc6 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 @@ -266,8 +266,7 @@ public class SimpleJpaRepository implements JpaRepositoryImplementation implements JpaRepositoryImplementation hints = getHints(); - return Optional.ofNullable(type == null ? entityManager.find(domainType, id, hints) : entityManager.find(domainType, id, type, hints)); + return Optional.ofNullable( + type == null ? entityManager.find(domainType, id, hints) : entityManager.find(domainType, id, type, hints)); } @Deprecated @@ -484,17 +484,17 @@ public class SimpleJpaRepository implements JpaRepositoryImplementation spec) { - CriteriaQuery cq = this.em.getCriteriaBuilder().createQuery(Integer.class); - cq.select(this.em.getCriteriaBuilder().literal(1)); + CriteriaQuery cq = this.entityManager.getCriteriaBuilder().createQuery(Integer.class); + cq.select(this.entityManager.getCriteriaBuilder().literal(1)); applySpecificationToCriteria(spec, getDomainClass(), cq); - TypedQuery query = applyRepositoryMethodMetadata(this.em.createQuery(cq)); + TypedQuery query = applyRepositoryMethodMetadata(this.entityManager.createQuery(cq)); return query.setMaxResults(1).getResultList().size() == 1; } @Override public long delete(Specification spec) { - CriteriaBuilder builder = this.em.getCriteriaBuilder(); + CriteriaBuilder builder = this.entityManager.getCriteriaBuilder(); CriteriaDelete delete = builder.createCriteriaDelete(getDomainClass()); if (spec != null) { @@ -505,7 +505,7 @@ public class SimpleJpaRepository implements JpaRepositoryImplementation implements JpaRepositoryImplementation fluentQuery = new FetchableFluentQueryByExample<>(example, finder, this::count, - this::exists, this.em, this.escapeCharacter); + this::exists, this.entityManager, this.escapeCharacter); return queryFunction.apply(fluentQuery); } @@ -558,7 +558,7 @@ public class SimpleJpaRepository implements JpaRepositoryImplementation> finder = sort -> getQuery(spec, getDomainClass(), sort); FetchableFluentQuery fluentQuery = new FetchableFluentQueryBySpecification(spec, getDomainClass(), - Sort.unsorted(), null, finder, this::count, this::exists, this.em); + Sort.unsorted(), null, finder, this::count, this::exists, this.entityManager); return queryFunction.apply((FetchableFluentQuery) fluentQuery); }