Skip to content

Commit 393fa63

Browse files
committed
Added missing null check for metadata.
See #2716 Closes #2897
1 parent 9fae43d commit 393fa63

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public Optional<T> findById(ID id) {
309309

310310
getQueryHints().withFetchGraphs(em).forEach(hints::put);
311311

312-
if (metadata.getComment() != null && provider.getCommentHintKey() != null) {
312+
if (metadata != null && metadata.getComment() != null && provider.getCommentHintKey() != null) {
313313
hints.put(provider.getCommentHintKey(), provider.getCommentHintValue(metadata.getComment()));
314314
}
315315

0 commit comments

Comments
 (0)