Skip to content

Commit 0348c68

Browse files
committed
Added missing null check for metadata.
See #2716 Closes #2897
1 parent ef662f2 commit 0348c68

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
@@ -304,7 +304,7 @@ public Optional<T> findById(ID id) {
304304

305305
getQueryHints().withFetchGraphs(em).forEach(hints::put);
306306

307-
if (metadata.getComment() != null && provider.getCommentHintKey() != null) {
307+
if (metadata != null && metadata.getComment() != null && provider.getCommentHintKey() != null) {
308308
hints.put(provider.getCommentHintKey(), provider.getCommentHintValue(metadata.getComment()));
309309
}
310310

0 commit comments

Comments
 (0)