Add additional null checks when applying hints.

It's possible to apply hints and hit a NullPointerException.

Resolves #2716.
This commit is contained in:
Greg L. Turnquist
2022-12-05 12:28:31 -06:00
parent e33f31ed93
commit 7dce3d119f

View File

@@ -829,6 +829,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) {
@@ -849,6 +853,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) {