Polishing.

Original pull request #2324
This commit is contained in:
Jens Schauder
2022-01-12 15:44:48 +01:00
parent 65aa03f31c
commit 6bae3c5a48
3 changed files with 5 additions and 4 deletions

View File

@@ -333,8 +333,8 @@ class JpaPersistentPropertyImpl extends AnnotationBasedPersistentProperty<JpaPer
continue;
}
// may cause NullPointerException if the returned value is null
return (boolean) AnnotationUtils.getValue(annotation, "updatable");
final Object updatable = AnnotationUtils.getValue(annotation, "updatable");
return (boolean) (updatable == null ? true : updatable);
}
return true;

View File

@@ -15,6 +15,8 @@
*/
package org.springframework.data.jpa.repository.config;
import static org.springframework.data.jpa.repository.config.BeanDefinitionNames.*;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.Collection;
@@ -52,8 +54,6 @@ import org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcesso
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
import static org.springframework.data.jpa.repository.config.BeanDefinitionNames.*;
/**
* JPA specific configuration extension parsing custom attributes from the XML namespace and
* {@link EnableJpaRepositories} annotation. Also, it registers bean definitions for a

View File

@@ -263,6 +263,7 @@ class StringQuery implements DeclaredQuery {
Integer parameterIndex = getParameterIndex(parameterIndexString);
String typeSource = matcher.group(COMPARISION_TYPE_GROUP);
Assert.isTrue(parameterIndexString != null || parameterName != null, () -> String.format("We need either a name or an index! Offending query string: %s", query));
String expression = spelExtractor.getParameter(parameterName == null ? parameterIndexString : parameterName);
String replacement = null;