Adapt to changes in entity creation metadata APIs in Spring Data Commons.

This commit is contained in:
Oliver Drotbohm
2022-02-15 15:12:58 +01:00
parent 7a991ff7ee
commit 99d2f62646
6 changed files with 12 additions and 112 deletions

View File

@@ -25,16 +25,15 @@ import java.util.Optional;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.convert.ConverterNotFoundException;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.CustomConversions;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.jdbc.core.mapping.JdbcValue;
import org.springframework.data.jdbc.support.JdbcUtil;
import org.springframework.data.mapping.Parameter;
import org.springframework.data.mapping.PersistentPropertyAccessor;
import org.springframework.data.mapping.PersistentPropertyPath;
import org.springframework.data.mapping.PreferredConstructor;
@@ -173,6 +172,7 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc
public int getSqlType(RelationalPersistentProperty property) {
return JdbcUtil.sqlTypeFor(getColumnType(property));
}
@Override
public Class<?> getColumnType(RelationalPersistentProperty property) {
return doGetColumnType(property);
@@ -597,7 +597,7 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc
@Override
@Nullable
public <T> T getParameterValue(PreferredConstructor.Parameter<T, RelationalPersistentProperty> parameter) {
public <T> T getParameterValue(Parameter<T, RelationalPersistentProperty> parameter) {
String parameterName = parameter.getName();
@@ -618,7 +618,7 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc
INSTANCE;
@Override
public <T> T getParameterValue(PreferredConstructor.Parameter<T, RelationalPersistentProperty> parameter) {
public <T> T getParameterValue(Parameter<T, RelationalPersistentProperty> parameter) {
return null;
}
}

View File

@@ -15,8 +15,8 @@
*/
package org.springframework.data.jdbc.core.mapping;
import org.springframework.data.mapping.PreferredConstructor;
import org.springframework.data.mapping.PreferredConstructor.Parameter;
import org.springframework.data.mapping.InstanceCreatorMetadata;
import org.springframework.data.mapping.Parameter;
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.mapping.model.Property;
import org.springframework.data.mapping.model.SimpleTypeHolder;
@@ -63,13 +63,13 @@ public class JdbcMappingContext extends RelationalMappingContext {
protected <T> RelationalPersistentEntity<T> createPersistentEntity(TypeInformation<T> typeInformation) {
RelationalPersistentEntity<T> entity = super.createPersistentEntity(typeInformation);
PreferredConstructor<T, RelationalPersistentProperty> constructor = entity.getPersistenceConstructor();
InstanceCreatorMetadata<RelationalPersistentProperty> creator = entity.getInstanceCreatorMetadata();
if (constructor == null) {
if (creator == null) {
return entity;
}
for (Parameter<Object, RelationalPersistentProperty> parameter : constructor.getParameters()) {
for (Parameter<Object, RelationalPersistentProperty> parameter : creator.getParameters()) {
Assert.state(StringUtils.hasText(parameter.getName()), () -> String.format(MISSING_PARAMETER_NAME, parameter));
}

View File

@@ -16,11 +16,11 @@
package org.springframework.data.jdbc.repository.query;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.DtoInstantiatingConverter;
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.mapping.model.EntityInstantiators;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.relational.repository.query.DtoInstantiatingConverter;
import org.springframework.data.repository.query.ResultProcessor;
import org.springframework.data.repository.query.ReturnedType;
import org.springframework.data.util.Lazy;