Reuse TypeInformation during PersistentPropertyPath and PersistentEntity lookups.
We now avoid Class -> TypeInformation conversion if we already have TypeInformation at hand. Closes #1679
This commit is contained in:
@@ -112,7 +112,7 @@ public class MappingJdbcConverter extends MappingRelationalConverter implements
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Class<?> getEntityColumnType(Class<?> type) {
|
||||
private Class<?> getEntityColumnType(TypeInformation<?> type) {
|
||||
|
||||
RelationalPersistentEntity<?> persistentEntity = getMappingContext().getPersistentEntity(type);
|
||||
|
||||
@@ -153,7 +153,7 @@ public class MappingJdbcConverter extends MappingRelationalConverter implements
|
||||
}
|
||||
|
||||
if (property.isEntity()) {
|
||||
Class<?> columnType = getEntityColumnType(property.getActualType());
|
||||
Class<?> columnType = getEntityColumnType(property.getTypeInformation().getActualType());
|
||||
|
||||
if (columnType != null) {
|
||||
return columnType;
|
||||
|
||||
@@ -837,7 +837,7 @@ class SqlGenerator {
|
||||
}
|
||||
|
||||
PersistentPropertyPath<RelationalPersistentProperty> persistentPropertyPath = mappingContext
|
||||
.getPersistentPropertyPath(order.getProperty(), entity.getType());
|
||||
.getPersistentPropertyPath(order.getProperty(), entity.getTypeInformation());
|
||||
|
||||
propertyToSortBy = persistentPropertyPath.getBaseProperty();
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ public class SqlParametersFactory {
|
||||
if (property.isEmbedded()) {
|
||||
|
||||
Object value = propertyAccessor.getProperty(property);
|
||||
RelationalPersistentEntity<?> embeddedEntity = context.getPersistentEntity(property.getType());
|
||||
RelationalPersistentEntity<?> embeddedEntity = context.getPersistentEntity(property.getTypeInformation());
|
||||
SqlIdentifierParameterSource additionalParameters = getParameterSource((T) value,
|
||||
(RelationalPersistentEntity<T>) embeddedEntity, prefix + property.getEmbeddedPrefix(), skipProperty);
|
||||
parameters.addAll(additionalParameters);
|
||||
|
||||
@@ -337,7 +337,7 @@ public class MappingRelationalConverter extends AbstractRelationalConverter impl
|
||||
return context.convert(documentAccessor, typeHint);
|
||||
}
|
||||
|
||||
RelationalPersistentEntity<?> entity = getMappingContext().getPersistentEntity(rawType);
|
||||
RelationalPersistentEntity<?> entity = getMappingContext().getPersistentEntity(typeHint);
|
||||
|
||||
if (entity == null) {
|
||||
throw new MappingException(
|
||||
|
||||
@@ -91,9 +91,9 @@ class DefaultAggregatePath implements AggregatePath {
|
||||
public AggregatePath append(RelationalPersistentProperty property) {
|
||||
|
||||
PersistentPropertyPath<? extends RelationalPersistentProperty> newPath = isRoot() //
|
||||
? context.getPersistentPropertyPath(property.getName(), rootType.getType()) //
|
||||
? context.getPersistentPropertyPath(property.getName(), rootType.getTypeInformation()) //
|
||||
: context.getPersistentPropertyPath(path.toDotPath() + "." + property.getName(),
|
||||
path.getBaseProperty().getOwner().getType());
|
||||
path.getBaseProperty().getOwner().getTypeInformation());
|
||||
|
||||
return context.getAggregatePath(newPath);
|
||||
}
|
||||
@@ -171,7 +171,8 @@ class DefaultAggregatePath implements AggregatePath {
|
||||
|
||||
@Override
|
||||
public RelationalPersistentEntity<?> getLeafEntity() {
|
||||
return isRoot() ? rootType : context.getPersistentEntity(getRequiredLeafProperty().getActualType());
|
||||
return isRoot() ? rootType
|
||||
: context.getPersistentEntity(getRequiredLeafProperty().getTypeInformation().getActualType());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -136,7 +136,8 @@ public class PersistentPropertyPathExtension {
|
||||
*/
|
||||
@Nullable
|
||||
public RelationalPersistentEntity<?> getLeafEntity() {
|
||||
return path == null ? entity : context.getPersistentEntity(path.getLeafProperty().getActualType());
|
||||
return path == null ? entity
|
||||
: context.getPersistentEntity(path.getLeafProperty().getTypeInformation().getActualType());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -363,8 +364,8 @@ public class PersistentPropertyPathExtension {
|
||||
public PersistentPropertyPathExtension extendBy(RelationalPersistentProperty property) {
|
||||
|
||||
PersistentPropertyPath<? extends RelationalPersistentProperty> newPath = path == null //
|
||||
? context.getPersistentPropertyPath(property.getName(), entity.getType()) //
|
||||
: context.getPersistentPropertyPath(path.toDotPath() + "." + property.getName(), entity.getType());
|
||||
? context.getPersistentPropertyPath(property.getName(), entity.getTypeInformation()) //
|
||||
: context.getPersistentPropertyPath(path.toDotPath() + "." + property.getName(), entity.getTypeInformation());
|
||||
|
||||
return new PersistentPropertyPathExtension(context, newPath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user