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 a2aaf3478e..0e000faf7a 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 @@ -244,7 +244,7 @@ public void deleteAllByIdInBatch(Iterable ids) { * Some JPA providers require {@code ids} to be a {@link Collection} so we must convert if it's not already. */ - if (Collection.class.isInstance(ids)) { + if (ids instanceof Collection) { query.setParameter("ids", ids); } else { Collection idsCollection = StreamSupport.stream(ids.spliterator(), false) @@ -854,11 +854,13 @@ private TypedQuery applyRepositoryMethodMetadata(TypedQuery query) { } LockModeType type = metadata.getLockModeType(); - TypedQuery toReturn = type == null ? query : query.setLockMode(type); + if (type != null) { + query.setLockMode(type); + } - applyQueryHints(toReturn); + applyQueryHints(query); - return toReturn; + return query; } private void applyQueryHints(Query query) {