Skip to content

Commit f585972

Browse files
author
trayanus1026
committed
Added missing null check for metadata.
See #2716 Closes #2897
1 parent be3d728 commit f585972

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

Lines changed: 1 addition & 1 deletion
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)