Add additional null checks when applying hints.
It's possible to apply hints and hit a NullPointerException. Resolves #2716.
This commit is contained in:
@@ -832,6 +832,10 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
|
||||
private void applyQueryHints(Query query) {
|
||||
|
||||
if (metadata == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
getQueryHints().withFetchGraphs(em).forEach(query::setHint);
|
||||
|
||||
if (metadata.getComment() != null && provider.getCommentHintKey() != null) {
|
||||
@@ -852,6 +856,10 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
|
||||
private void applyQueryHintsForCount(Query query) {
|
||||
|
||||
if (metadata == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
getQueryHintsForCount().forEach(query::setHint);
|
||||
|
||||
if (metadata.getComment() != null && provider.getCommentHintKey() != null) {
|
||||
|
||||
Reference in New Issue
Block a user