diff --git a/src/main/java/org/springframework/data/jdbc/core/CascadingDataAccessStrategy.java b/src/main/java/org/springframework/data/jdbc/core/CascadingDataAccessStrategy.java index 86cbb916..311dbd9c 100644 --- a/src/main/java/org/springframework/data/jdbc/core/CascadingDataAccessStrategy.java +++ b/src/main/java/org/springframework/data/jdbc/core/CascadingDataAccessStrategy.java @@ -22,7 +22,7 @@ import java.util.function.Consumer; import java.util.function.Function; import org.springframework.data.mapping.PropertyPath; -import org.springframework.data.relational.core.mapping.JdbcPersistentProperty; +import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; /** * Delegates each methods to the {@link DataAccessStrategy}s passed to the constructor in turn until the first that does @@ -90,7 +90,7 @@ public class CascadingDataAccessStrategy implements DataAccessStrategy { } @Override - public Iterable findAllByProperty(Object rootId, JdbcPersistentProperty property) { + public Iterable findAllByProperty(Object rootId, RelationalPersistentProperty property) { return collect(das -> das.findAllByProperty(rootId, property)); } diff --git a/src/main/java/org/springframework/data/jdbc/core/DataAccessStrategy.java b/src/main/java/org/springframework/data/jdbc/core/DataAccessStrategy.java index cdfb1b8c..8d45dd86 100644 --- a/src/main/java/org/springframework/data/jdbc/core/DataAccessStrategy.java +++ b/src/main/java/org/springframework/data/jdbc/core/DataAccessStrategy.java @@ -18,7 +18,7 @@ package org.springframework.data.jdbc.core; import java.util.Map; import org.springframework.data.mapping.PropertyPath; -import org.springframework.data.relational.core.mapping.JdbcPersistentProperty; +import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; import org.springframework.lang.Nullable; /** @@ -129,7 +129,7 @@ public interface DataAccessStrategy { * @param rootId Id of the root object on which the {@literal propertyPath} is based. * @param property Leading from the root object to the entities to be found. */ - Iterable findAllByProperty(Object rootId, JdbcPersistentProperty property); + Iterable findAllByProperty(Object rootId, RelationalPersistentProperty property); /** * returns if a row with the given id exists for the given type. diff --git a/src/main/java/org/springframework/data/jdbc/core/DefaultDataAccessStrategy.java b/src/main/java/org/springframework/data/jdbc/core/DefaultDataAccessStrategy.java index 346598f3..3ae56f70 100644 --- a/src/main/java/org/springframework/data/jdbc/core/DefaultDataAccessStrategy.java +++ b/src/main/java/org/springframework/data/jdbc/core/DefaultDataAccessStrategy.java @@ -33,9 +33,9 @@ import org.springframework.data.mapping.PersistentPropertyAccessor; import org.springframework.data.mapping.PropertyHandler; import org.springframework.data.mapping.PropertyPath; import org.springframework.data.mapping.model.ConvertingPropertyAccessor; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntity; -import org.springframework.data.relational.core.mapping.JdbcPersistentProperty; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; +import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; @@ -58,7 +58,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { + "JDBC driver returns it."; private final @NonNull SqlGeneratorSource sqlGeneratorSource; - private final @NonNull JdbcMappingContext context; + private final @NonNull RelationalMappingContext context; private final @NonNull NamedParameterJdbcOperations operations; private final @NonNull EntityInstantiators instantiators; private final @NonNull DataAccessStrategy accessStrategy; @@ -67,7 +67,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { * Creates a {@link DefaultDataAccessStrategy} which references it self for resolution of recursive data accesses. * Only suitable if this is the only access strategy in use. */ - public DefaultDataAccessStrategy(SqlGeneratorSource sqlGeneratorSource, JdbcMappingContext context, + public DefaultDataAccessStrategy(SqlGeneratorSource sqlGeneratorSource, RelationalMappingContext context, NamedParameterJdbcOperations operations, EntityInstantiators instantiators) { this.sqlGeneratorSource = sqlGeneratorSource; @@ -81,12 +81,12 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { public void insert(T instance, Class domainType, Map additionalParameters) { KeyHolder holder = new GeneratedKeyHolder(); - JdbcPersistentEntity persistentEntity = getRequiredPersistentEntity(domainType); + RelationalPersistentEntity persistentEntity = getRequiredPersistentEntity(domainType); MapSqlParameterSource parameterSource = getPropertyMap(instance, persistentEntity); Object idValue = getIdValueOrNull(instance, persistentEntity); - JdbcPersistentProperty idProperty = persistentEntity.getIdProperty(); + RelationalPersistentProperty idProperty = persistentEntity.getIdProperty(); if (idValue != null) { @@ -120,7 +120,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { @Override public void update(S instance, Class domainType) { - JdbcPersistentEntity persistentEntity = getRequiredPersistentEntity(domainType); + RelationalPersistentEntity persistentEntity = getRequiredPersistentEntity(domainType); operations.update(sql(domainType).getUpdate(), getPropertyMap(instance, persistentEntity)); } @@ -145,9 +145,9 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { @Override public void delete(Object rootId, PropertyPath propertyPath) { - JdbcPersistentEntity rootEntity = context.getRequiredPersistentEntity(propertyPath.getOwningType()); + RelationalPersistentEntity rootEntity = context.getRequiredPersistentEntity(propertyPath.getOwningType()); - JdbcPersistentProperty referencingProperty = rootEntity.getRequiredPersistentProperty(propertyPath.getSegment()); + RelationalPersistentProperty referencingProperty = rootEntity.getRequiredPersistentProperty(propertyPath.getSegment()); Assert.notNull(referencingProperty, "No property found matching the PropertyPath " + propertyPath); String format = sql(rootEntity.getType()).createDeleteByPath(propertyPath); @@ -244,7 +244,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { */ @Override @SuppressWarnings("unchecked") - public Iterable findAllByProperty(Object rootId, JdbcPersistentProperty property) { + public Iterable findAllByProperty(Object rootId, RelationalPersistentProperty property) { Assert.notNull(rootId, "rootId must not be null."); @@ -277,11 +277,11 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { return result; } - private MapSqlParameterSource getPropertyMap(final S instance, JdbcPersistentEntity persistentEntity) { + private MapSqlParameterSource getPropertyMap(final S instance, RelationalPersistentEntity persistentEntity) { MapSqlParameterSource parameters = new MapSqlParameterSource(); - persistentEntity.doWithProperties((PropertyHandler) property -> { + persistentEntity.doWithProperties((PropertyHandler) property -> { if (!property.isEntity()) { Object value = persistentEntity.getPropertyAccessor(instance).getProperty(property); @@ -295,7 +295,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { @SuppressWarnings("unchecked") @Nullable - private ID getIdValueOrNull(S instance, JdbcPersistentEntity persistentEntity) { + private ID getIdValueOrNull(S instance, RelationalPersistentEntity persistentEntity) { ID idValue = (ID) persistentEntity.getIdentifierAccessor(instance).getIdentifier(); @@ -303,16 +303,16 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { } private static boolean isIdPropertyNullOrScalarZero(@Nullable ID idValue, - JdbcPersistentEntity persistentEntity) { + RelationalPersistentEntity persistentEntity) { - JdbcPersistentProperty idProperty = persistentEntity.getIdProperty(); + RelationalPersistentProperty idProperty = persistentEntity.getIdProperty(); return idValue == null // || idProperty == null // || (idProperty.getType() == int.class && idValue.equals(0)) // || (idProperty.getType() == long.class && idValue.equals(0L)); } - private void setIdFromJdbc(S instance, KeyHolder holder, JdbcPersistentEntity persistentEntity) { + private void setIdFromJdbc(S instance, KeyHolder holder, RelationalPersistentEntity persistentEntity) { try { @@ -321,7 +321,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { PersistentPropertyAccessor accessor = persistentEntity.getPropertyAccessor(instance); ConvertingPropertyAccessor convertingPropertyAccessor = new ConvertingPropertyAccessor(accessor, context.getConversions()); - JdbcPersistentProperty idProperty = persistentEntity.getRequiredIdProperty(); + RelationalPersistentProperty idProperty = persistentEntity.getRequiredIdProperty(); convertingPropertyAccessor.setProperty(idProperty, it); }); @@ -331,7 +331,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { } } - private Optional getIdFromHolder(KeyHolder holder, JdbcPersistentEntity persistentEntity) { + private Optional getIdFromHolder(KeyHolder holder, RelationalPersistentEntity persistentEntity) { try { // MySQL just returns one value with a special name @@ -348,7 +348,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { } @SuppressWarnings("unchecked") - private RowMapper getMapEntityRowMapper(JdbcPersistentProperty property) { + private RowMapper getMapEntityRowMapper(RelationalPersistentProperty property) { String keyColumn = property.getKeyColumn(); @@ -364,8 +364,8 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { } @SuppressWarnings("unchecked") - private JdbcPersistentEntity getRequiredPersistentEntity(Class domainType) { - return (JdbcPersistentEntity) context.getRequiredPersistentEntity(domainType); + private RelationalPersistentEntity getRequiredPersistentEntity(Class domainType) { + return (RelationalPersistentEntity) context.getRequiredPersistentEntity(domainType); } @Nullable @@ -375,7 +375,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { return null; } - JdbcPersistentEntity persistentEntity = context.getPersistentEntity(from.getClass()); + RelationalPersistentEntity persistentEntity = context.getPersistentEntity(from.getClass()); Object id = persistentEntity == null ? null : persistentEntity.getIdentifierAccessor(from).getIdentifier(); diff --git a/src/main/java/org/springframework/data/jdbc/core/DefaultJdbcInterpreter.java b/src/main/java/org/springframework/data/jdbc/core/DefaultJdbcInterpreter.java index 3f7a588c..ef036bb1 100644 --- a/src/main/java/org/springframework/data/jdbc/core/DefaultJdbcInterpreter.java +++ b/src/main/java/org/springframework/data/jdbc/core/DefaultJdbcInterpreter.java @@ -25,8 +25,8 @@ import org.springframework.data.relational.core.conversion.DbAction.Delete; import org.springframework.data.relational.core.conversion.DbAction.DeleteAll; import org.springframework.data.relational.core.conversion.DbAction.Insert; import org.springframework.data.relational.core.conversion.DbAction.Update; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntity; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; import org.springframework.lang.Nullable; import org.springframework.util.Assert; @@ -39,10 +39,10 @@ import org.springframework.util.Assert; */ class DefaultJdbcInterpreter implements Interpreter { - private final JdbcMappingContext context; + private final RelationalMappingContext context; private final DataAccessStrategy accessStrategy; - DefaultJdbcInterpreter(JdbcMappingContext context, DataAccessStrategy accessStrategy) { + DefaultJdbcInterpreter(RelationalMappingContext context, DataAccessStrategy accessStrategy) { this.context = context; this.accessStrategy = accessStrategy; @@ -95,7 +95,7 @@ class DefaultJdbcInterpreter implements Interpreter { return; } - JdbcPersistentEntity persistentEntity = context.getRequiredPersistentEntity(dependingOn.getEntityType()); + RelationalPersistentEntity persistentEntity = context.getRequiredPersistentEntity(dependingOn.getEntityType()); String columnName = getColumnNameForReverseColumn(insert, persistentEntity); @@ -105,11 +105,11 @@ class DefaultJdbcInterpreter implements Interpreter { } @Nullable - private Object getIdFromEntityDependingOn(DbAction dependingOn, JdbcPersistentEntity persistentEntity) { + private Object getIdFromEntityDependingOn(DbAction dependingOn, RelationalPersistentEntity persistentEntity) { return persistentEntity.getIdentifierAccessor(dependingOn.getEntity()).getIdentifier(); } - private String getColumnNameForReverseColumn(Insert insert, JdbcPersistentEntity persistentEntity) { + private String getColumnNameForReverseColumn(Insert insert, RelationalPersistentEntity persistentEntity) { PropertyPath path = insert.getPropertyPath().getPath(); diff --git a/src/main/java/org/springframework/data/jdbc/core/DelegatingDataAccessStrategy.java b/src/main/java/org/springframework/data/jdbc/core/DelegatingDataAccessStrategy.java index 32588959..e6c76610 100644 --- a/src/main/java/org/springframework/data/jdbc/core/DelegatingDataAccessStrategy.java +++ b/src/main/java/org/springframework/data/jdbc/core/DelegatingDataAccessStrategy.java @@ -18,7 +18,7 @@ package org.springframework.data.jdbc.core; import java.util.Map; import org.springframework.data.mapping.PropertyPath; -import org.springframework.data.relational.core.mapping.JdbcPersistentProperty; +import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; import org.springframework.util.Assert; /** @@ -86,7 +86,7 @@ public class DelegatingDataAccessStrategy implements DataAccessStrategy { } @Override - public Iterable findAllByProperty(Object rootId, JdbcPersistentProperty property) { + public Iterable findAllByProperty(Object rootId, RelationalPersistentProperty property) { Assert.notNull(delegate, "Delegate is null"); diff --git a/src/main/java/org/springframework/data/jdbc/core/EntityRowMapper.java b/src/main/java/org/springframework/data/jdbc/core/EntityRowMapper.java index 68f3d7cf..152fd2f7 100644 --- a/src/main/java/org/springframework/data/jdbc/core/EntityRowMapper.java +++ b/src/main/java/org/springframework/data/jdbc/core/EntityRowMapper.java @@ -31,9 +31,9 @@ import org.springframework.data.mapping.PersistentPropertyAccessor; import org.springframework.data.mapping.PreferredConstructor.Parameter; import org.springframework.data.mapping.model.ConvertingPropertyAccessor; import org.springframework.data.mapping.model.ParameterValueProvider; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntity; -import org.springframework.data.relational.core.mapping.JdbcPersistentProperty; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; +import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; import org.springframework.jdbc.core.RowMapper; import org.springframework.lang.Nullable; import org.springframework.util.Assert; @@ -52,15 +52,15 @@ public class EntityRowMapper implements RowMapper { private static final Converter, Map> ITERABLE_OF_ENTRY_TO_MAP_CONVERTER = new IterableOfEntryToMapConverter(); - private final JdbcPersistentEntity entity; + private final RelationalPersistentEntity entity; private final ConversionService conversions; - private final JdbcMappingContext context; + private final RelationalMappingContext context; private final DataAccessStrategy accessStrategy; - private final JdbcPersistentProperty idProperty; + private final RelationalPersistentProperty idProperty; private final EntityInstantiators instantiators; - public EntityRowMapper(JdbcPersistentEntity entity, JdbcMappingContext context, EntityInstantiators instantiators, + public EntityRowMapper(RelationalPersistentEntity entity, RelationalMappingContext context, EntityInstantiators instantiators, DataAccessStrategy accessStrategy) { this.entity = entity; @@ -85,7 +85,7 @@ public class EntityRowMapper implements RowMapper { Object id = idProperty == null ? null : readFrom(resultSet, idProperty, ""); - for (JdbcPersistentProperty property : entity) { + for (RelationalPersistentProperty property : entity) { if (property.isCollectionLike() && id != null) { propertyAccessor.setProperty(property, accessStrategy.findAllByProperty(id, property)); @@ -105,12 +105,12 @@ public class EntityRowMapper implements RowMapper { * Read a single value or a complete Entity from the {@link ResultSet} passed as an argument. * * @param resultSet the {@link ResultSet} to extract the value from. Must not be {@code null}. - * @param property the {@link JdbcPersistentProperty} for which the value is intended. Must not be {@code null}. + * @param property the {@link RelationalPersistentProperty} for which the value is intended. Must not be {@code null}. * @param prefix to be used for all column names accessed by this method. Must not be {@code null}. * @return the value read from the {@link ResultSet}. May be {@code null}. */ @Nullable - private Object readFrom(ResultSet resultSet, JdbcPersistentProperty property, String prefix) { + private Object readFrom(ResultSet resultSet, RelationalPersistentProperty property, String prefix) { try { @@ -131,7 +131,7 @@ public class EntityRowMapper implements RowMapper { String prefix = property.getName() + "_"; @SuppressWarnings("unchecked") - JdbcPersistentEntity entity = (JdbcPersistentEntity) context + RelationalPersistentEntity entity = (RelationalPersistentEntity) context .getRequiredPersistentEntity(property.getActualType()); if (readFrom(rs, entity.getRequiredIdProperty(), prefix) == null) { @@ -144,24 +144,24 @@ public class EntityRowMapper implements RowMapper { PersistentPropertyAccessor accessor = entity.getPropertyAccessor(instance); ConvertingPropertyAccessor propertyAccessor = new ConvertingPropertyAccessor(accessor, conversions); - for (JdbcPersistentProperty p : entity) { + for (RelationalPersistentProperty p : entity) { propertyAccessor.setProperty(p, readFrom(rs, p, prefix)); } return instance; } - private S createInstance(JdbcPersistentEntity entity, ResultSet rs, String prefix) { + private S createInstance(RelationalPersistentEntity entity, ResultSet rs, String prefix) { return instantiators.getInstantiatorFor(entity) // .createInstance(entity, new ResultSetParameterValueProvider(rs, entity, conversions, prefix)); } @RequiredArgsConstructor - private static class ResultSetParameterValueProvider implements ParameterValueProvider { + private static class ResultSetParameterValueProvider implements ParameterValueProvider { @NonNull private final ResultSet resultSet; - @NonNull private final JdbcPersistentEntity entity; + @NonNull private final RelationalPersistentEntity entity; @NonNull private final ConversionService conversionService; @NonNull private final String prefix; @@ -170,7 +170,7 @@ public class EntityRowMapper implements RowMapper { * @see org.springframework.data.mapping.model.ParameterValueProvider#getParameterValue(org.springframework.data.mapping.PreferredConstructor.Parameter) */ @Override - public T getParameterValue(Parameter parameter) { + public T getParameterValue(Parameter parameter) { String parameterName = parameter.getName(); Assert.notNull(parameterName, "A constructor parameter name must not be null to be used with Spring Data JDBC"); diff --git a/src/main/java/org/springframework/data/jdbc/core/JdbcAggregateTemplate.java b/src/main/java/org/springframework/data/jdbc/core/JdbcAggregateTemplate.java index 77e19cf9..2ebd3ed4 100644 --- a/src/main/java/org/springframework/data/jdbc/core/JdbcAggregateTemplate.java +++ b/src/main/java/org/springframework/data/jdbc/core/JdbcAggregateTemplate.java @@ -21,11 +21,11 @@ import org.springframework.context.ApplicationEventPublisher; import org.springframework.data.mapping.IdentifierAccessor; import org.springframework.data.relational.core.conversion.AggregateChange; import org.springframework.data.relational.core.conversion.Interpreter; -import org.springframework.data.relational.core.conversion.JdbcEntityDeleteWriter; -import org.springframework.data.relational.core.conversion.JdbcEntityWriter; +import org.springframework.data.relational.core.conversion.RelationalEntityDeleteWriter; +import org.springframework.data.relational.core.conversion.RelationalEntityWriter; import org.springframework.data.relational.core.conversion.AggregateChange.Kind; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntity; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; import org.springframework.data.relational.core.mapping.event.AfterDeleteEvent; import org.springframework.data.relational.core.mapping.event.AfterLoadEvent; import org.springframework.data.relational.core.mapping.event.AfterSaveEvent; @@ -46,22 +46,22 @@ import org.springframework.util.Assert; public class JdbcAggregateTemplate implements JdbcAggregateOperations { private final ApplicationEventPublisher publisher; - private final JdbcMappingContext context; + private final RelationalMappingContext context; private final Interpreter interpreter; - private final JdbcEntityWriter jdbcEntityWriter; - private final JdbcEntityDeleteWriter jdbcEntityDeleteWriter; + private final RelationalEntityWriter jdbcEntityWriter; + private final RelationalEntityDeleteWriter jdbcEntityDeleteWriter; private final DataAccessStrategy accessStrategy; - public JdbcAggregateTemplate(ApplicationEventPublisher publisher, JdbcMappingContext context, + public JdbcAggregateTemplate(ApplicationEventPublisher publisher, RelationalMappingContext context, DataAccessStrategy dataAccessStrategy) { this.publisher = publisher; this.context = context; - this.jdbcEntityWriter = new JdbcEntityWriter(context); - this.jdbcEntityDeleteWriter = new JdbcEntityDeleteWriter(context); + this.jdbcEntityWriter = new RelationalEntityWriter(context); + this.jdbcEntityDeleteWriter = new RelationalEntityDeleteWriter(context); this.accessStrategy = dataAccessStrategy; this.interpreter = new DefaultJdbcInterpreter(context, accessStrategy); } @@ -71,7 +71,7 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations { Assert.notNull(instance, "Aggregate instance must not be null!"); - JdbcPersistentEntity entity = context.getRequiredPersistentEntity(instance.getClass()); + RelationalPersistentEntity entity = context.getRequiredPersistentEntity(instance.getClass()); IdentifierAccessor identifierAccessor = entity.getIdentifierAccessor(instance); AggregateChange change = createChange(instance); @@ -192,7 +192,7 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations { for (T e : all) { - JdbcPersistentEntity entity = context.getRequiredPersistentEntity(e.getClass()); + RelationalPersistentEntity entity = context.getRequiredPersistentEntity(e.getClass()); IdentifierAccessor identifierAccessor = entity.getIdentifierAccessor(e); publishAfterLoad(identifierAccessor.getRequiredIdentifier(), e); diff --git a/src/main/java/org/springframework/data/jdbc/core/SqlGenerator.java b/src/main/java/org/springframework/data/jdbc/core/SqlGenerator.java index 76452c77..15e56f60 100644 --- a/src/main/java/org/springframework/data/jdbc/core/SqlGenerator.java +++ b/src/main/java/org/springframework/data/jdbc/core/SqlGenerator.java @@ -27,9 +27,9 @@ import java.util.stream.Stream; import org.springframework.data.jdbc.repository.support.SimpleJdbcRepository; import org.springframework.data.mapping.PropertyHandler; import org.springframework.data.mapping.PropertyPath; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntity; -import org.springframework.data.relational.core.mapping.JdbcPersistentProperty; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; +import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; import org.springframework.data.util.Lazy; import org.springframework.data.util.StreamUtils; import org.springframework.lang.Nullable; @@ -43,8 +43,8 @@ import org.springframework.util.Assert; */ class SqlGenerator { - private final JdbcPersistentEntity entity; - private final JdbcMappingContext context; + private final RelationalPersistentEntity entity; + private final RelationalMappingContext context; private final List columnNames = new ArrayList<>(); private final List nonIdColumnNames = new ArrayList<>(); @@ -61,7 +61,7 @@ class SqlGenerator { private final Lazy deleteByListSql = Lazy.of(this::createDeleteByListSql); private final SqlGeneratorSource sqlGeneratorSource; - SqlGenerator(JdbcMappingContext context, JdbcPersistentEntity entity, SqlGeneratorSource sqlGeneratorSource) { + SqlGenerator(RelationalMappingContext context, RelationalPersistentEntity entity, SqlGeneratorSource sqlGeneratorSource) { this.context = context; this.entity = entity; @@ -71,7 +71,7 @@ class SqlGenerator { private void initColumnNames() { - entity.doWithProperties((PropertyHandler) p -> { + entity.doWithProperties((PropertyHandler) p -> { // the referencing column of referenced entity is expected to be on the other side of the relation if (!p.isEntity()) { columnNames.add(p.getColumnName()); @@ -180,7 +180,7 @@ class SqlGenerator { */ private void addColumnsAndJoinsForOneToOneReferences(SelectBuilder builder) { - for (JdbcPersistentProperty property : entity) { + for (RelationalPersistentProperty property : entity) { if (!property.isEntity() // || Collection.class.isAssignableFrom(property.getType()) // || Map.class.isAssignableFrom(property.getType()) // @@ -188,12 +188,12 @@ class SqlGenerator { continue; } - JdbcPersistentEntity refEntity = context.getRequiredPersistentEntity(property.getActualType()); + RelationalPersistentEntity refEntity = context.getRequiredPersistentEntity(property.getActualType()); String joinAlias = property.getName(); builder.join(jb -> jb.leftOuter().table(refEntity.getTableName()).as(joinAlias) // .where(property.getReverseColumnName()).eq().column(entity.getTableName(), entity.getIdColumn())); - for (JdbcPersistentProperty refProperty : refEntity) { + for (RelationalPersistentProperty refProperty : refEntity) { builder.column( // cb -> cb.tableAlias(joinAlias) // .column(refProperty.getColumnName()) // @@ -205,7 +205,7 @@ class SqlGenerator { private void addColumnsForSimpleProperties(SelectBuilder builder) { - for (JdbcPersistentProperty property : entity) { + for (RelationalPersistentProperty property : entity) { if (property.isEntity()) { continue; @@ -224,7 +224,7 @@ class SqlGenerator { .flatMap(p -> getColumnNameStream(p, prefix)); } - private Stream getColumnNameStream(JdbcPersistentProperty p, String prefix) { + private Stream getColumnNameStream(RelationalPersistentProperty p, String prefix) { if (p.isEntity()) { return sqlGeneratorSource.getSqlGenerator(p.getType()).getColumnNameStream(prefix + p.getColumnName() + "_"); @@ -286,10 +286,10 @@ class SqlGenerator { return String.format("DELETE FROM %s", entity.getTableName()); } - JdbcPersistentEntity entityToDelete = context.getRequiredPersistentEntity(path.getLeafType()); + RelationalPersistentEntity entityToDelete = context.getRequiredPersistentEntity(path.getLeafType()); - JdbcPersistentEntity owningEntity = context.getRequiredPersistentEntity(path.getOwningType()); - JdbcPersistentProperty property = owningEntity.getRequiredPersistentProperty(path.getSegment()); + RelationalPersistentEntity owningEntity = context.getRequiredPersistentEntity(path.getOwningType()); + RelationalPersistentProperty property = owningEntity.getRequiredPersistentProperty(path.getSegment()); String innerMostCondition = String.format("%s IS NOT NULL", property.getReverseColumnName()); @@ -304,9 +304,9 @@ class SqlGenerator { String createDeleteByPath(PropertyPath path) { - JdbcPersistentEntity entityToDelete = context.getRequiredPersistentEntity(path.getLeafType()); - JdbcPersistentEntity owningEntity = context.getRequiredPersistentEntity(path.getOwningType()); - JdbcPersistentProperty property = owningEntity.getRequiredPersistentProperty(path.getSegment()); + RelationalPersistentEntity entityToDelete = context.getRequiredPersistentEntity(path.getLeafType()); + RelationalPersistentEntity owningEntity = context.getRequiredPersistentEntity(path.getOwningType()); + RelationalPersistentProperty property = owningEntity.getRequiredPersistentProperty(path.getSegment()); String innerMostCondition = String.format("%s = :rootId", property.getReverseColumnName()); @@ -321,8 +321,8 @@ class SqlGenerator { return innerCondition; } - JdbcPersistentEntity entity = context.getRequiredPersistentEntity(path.getOwningType()); - JdbcPersistentProperty property = entity.getPersistentProperty(path.getSegment()); + RelationalPersistentEntity entity = context.getRequiredPersistentEntity(path.getOwningType()); + RelationalPersistentProperty property = entity.getPersistentProperty(path.getSegment()); Assert.notNull(property, "could not find property for path " + path.getSegment() + " in " + entity); diff --git a/src/main/java/org/springframework/data/jdbc/core/SqlGeneratorSource.java b/src/main/java/org/springframework/data/jdbc/core/SqlGeneratorSource.java index e560d130..0d6c8efd 100644 --- a/src/main/java/org/springframework/data/jdbc/core/SqlGeneratorSource.java +++ b/src/main/java/org/springframework/data/jdbc/core/SqlGeneratorSource.java @@ -20,7 +20,7 @@ import lombok.RequiredArgsConstructor; import java.util.HashMap; import java.util.Map; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; /** * Provides {@link SqlGenerator}s per domain type. Instances get cached, so when asked multiple times for the same domain @@ -33,7 +33,7 @@ import org.springframework.data.relational.core.mapping.JdbcMappingContext; public class SqlGeneratorSource { private final Map sqlGeneratorCache = new HashMap<>(); - private final JdbcMappingContext context; + private final RelationalMappingContext context; SqlGenerator getSqlGenerator(Class domainType) { diff --git a/src/main/java/org/springframework/data/jdbc/mybatis/MyBatisDataAccessStrategy.java b/src/main/java/org/springframework/data/jdbc/mybatis/MyBatisDataAccessStrategy.java index 4bf32a3a..08b36769 100644 --- a/src/main/java/org/springframework/data/jdbc/mybatis/MyBatisDataAccessStrategy.java +++ b/src/main/java/org/springframework/data/jdbc/mybatis/MyBatisDataAccessStrategy.java @@ -29,8 +29,8 @@ import org.springframework.data.jdbc.core.DefaultDataAccessStrategy; import org.springframework.data.jdbc.core.DelegatingDataAccessStrategy; import org.springframework.data.jdbc.core.SqlGeneratorSource; import org.springframework.data.mapping.PropertyPath; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentProperty; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; import org.springframework.util.Assert; @@ -57,7 +57,7 @@ public class MyBatisDataAccessStrategy implements DataAccessStrategy { * Create a {@link DataAccessStrategy} that first checks for queries defined by MyBatis and if it doesn't find one * uses a {@link DefaultDataAccessStrategy} */ - public static DataAccessStrategy createCombinedAccessStrategy(JdbcMappingContext context, + public static DataAccessStrategy createCombinedAccessStrategy(RelationalMappingContext context, NamedParameterJdbcOperations operations, SqlSession sqlSession) { return createCombinedAccessStrategy(context, new EntityInstantiators(), operations, sqlSession, NamespaceStrategy.DEFAULT_INSTANCE); @@ -67,7 +67,7 @@ public class MyBatisDataAccessStrategy implements DataAccessStrategy { * Create a {@link DataAccessStrategy} that first checks for queries defined by MyBatis and if it doesn't find one * uses a {@link DefaultDataAccessStrategy} */ - public static DataAccessStrategy createCombinedAccessStrategy(JdbcMappingContext context, + public static DataAccessStrategy createCombinedAccessStrategy(RelationalMappingContext context, EntityInstantiators instantiators, NamedParameterJdbcOperations operations, SqlSession sqlSession, NamespaceStrategy namespaceStrategy) { @@ -102,7 +102,7 @@ public class MyBatisDataAccessStrategy implements DataAccessStrategy { * transaction. Note that the resulting {@link DataAccessStrategy} only handles MyBatis. It does not include the * functionality of the {@link org.springframework.data.jdbc.core.DefaultDataAccessStrategy} which one normally still * wants. Use - * {@link #createCombinedAccessStrategy(JdbcMappingContext, EntityInstantiators, NamedParameterJdbcOperations, SqlSession, NamespaceStrategy)} + * {@link #createCombinedAccessStrategy(RelationalMappingContext, EntityInstantiators, NamedParameterJdbcOperations, SqlSession, NamespaceStrategy)} * to create such a {@link DataAccessStrategy}. * * @param sqlSession Must be non {@literal null}. @@ -191,7 +191,7 @@ public class MyBatisDataAccessStrategy implements DataAccessStrategy { } @Override - public Iterable findAllByProperty(Object rootId, JdbcPersistentProperty property) { + public Iterable findAllByProperty(Object rootId, RelationalPersistentProperty property) { return sqlSession().selectList( namespace(property.getOwner().getType()) + ".findAllByProperty-" + property.getName(), new MyBatisContext(rootId, null, property.getType(), Collections.emptyMap())); diff --git a/src/main/java/org/springframework/data/jdbc/repository/config/JdbcAuditingRegistrar.java b/src/main/java/org/springframework/data/jdbc/repository/config/JdbcAuditingRegistrar.java index f52f2953..593f7585 100644 --- a/src/main/java/org/springframework/data/jdbc/repository/config/JdbcAuditingRegistrar.java +++ b/src/main/java/org/springframework/data/jdbc/repository/config/JdbcAuditingRegistrar.java @@ -24,7 +24,7 @@ import org.springframework.context.annotation.ImportBeanDefinitionRegistrar; import org.springframework.data.auditing.IsNewAwareAuditingHandler; import org.springframework.data.auditing.config.AuditingBeanDefinitionRegistrarSupport; import org.springframework.data.auditing.config.AuditingConfiguration; -import org.springframework.data.relational.domain.support.JdbcAuditingEventListener; +import org.springframework.data.relational.domain.support.RelationalAuditingEventListener; import org.springframework.util.Assert; /** @@ -78,7 +78,7 @@ class JdbcAuditingRegistrar extends AuditingBeanDefinitionRegistrarSupport { } /** - * Register the bean definition of {@link JdbcAuditingEventListener}. {@inheritDoc} + * Register the bean definition of {@link RelationalAuditingEventListener}. {@inheritDoc} * * @see AuditingBeanDefinitionRegistrarSupport#registerAuditListenerBeanDefinition(BeanDefinition, * BeanDefinitionRegistry) @@ -87,7 +87,7 @@ class JdbcAuditingRegistrar extends AuditingBeanDefinitionRegistrarSupport { protected void registerAuditListenerBeanDefinition(BeanDefinition auditingHandlerDefinition, BeanDefinitionRegistry registry) { - Class listenerClass = JdbcAuditingEventListener.class; + Class listenerClass = RelationalAuditingEventListener.class; BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(listenerClass) // .addConstructorArgReference(AUDITING_HANDLER_BEAN_NAME); diff --git a/src/main/java/org/springframework/data/jdbc/repository/config/JdbcConfiguration.java b/src/main/java/org/springframework/data/jdbc/repository/config/JdbcConfiguration.java index 6eef73e0..82171e6d 100644 --- a/src/main/java/org/springframework/data/jdbc/repository/config/JdbcConfiguration.java +++ b/src/main/java/org/springframework/data/jdbc/repository/config/JdbcConfiguration.java @@ -20,7 +20,7 @@ import java.util.Optional; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.relational.core.mapping.ConversionCustomizer; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; import org.springframework.data.relational.core.mapping.NamingStrategy; /** @@ -34,10 +34,10 @@ import org.springframework.data.relational.core.mapping.NamingStrategy; public class JdbcConfiguration { @Bean - JdbcMappingContext jdbcMappingContext(Optional namingStrategy, + RelationalMappingContext jdbcMappingContext(Optional namingStrategy, Optional conversionCustomizer) { - return new JdbcMappingContext(namingStrategy.orElse(NamingStrategy.INSTANCE), + return new RelationalMappingContext(namingStrategy.orElse(NamingStrategy.INSTANCE), conversionCustomizer.orElse(ConversionCustomizer.NONE)); } } diff --git a/src/main/java/org/springframework/data/jdbc/repository/support/JdbcQueryLookupStrategy.java b/src/main/java/org/springframework/data/jdbc/repository/support/JdbcQueryLookupStrategy.java index 60837b16..b4d88fb8 100644 --- a/src/main/java/org/springframework/data/jdbc/repository/support/JdbcQueryLookupStrategy.java +++ b/src/main/java/org/springframework/data/jdbc/repository/support/JdbcQueryLookupStrategy.java @@ -23,7 +23,7 @@ import org.springframework.data.jdbc.core.DataAccessStrategy; import org.springframework.data.jdbc.core.EntityRowMapper; import org.springframework.data.jdbc.repository.RowMapperMap; import org.springframework.data.projection.ProjectionFactory; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; import org.springframework.data.repository.core.NamedQueries; import org.springframework.data.repository.core.RepositoryMetadata; import org.springframework.data.repository.query.QueryLookupStrategy; @@ -43,7 +43,7 @@ import org.springframework.util.Assert; */ class JdbcQueryLookupStrategy implements QueryLookupStrategy { - private final JdbcMappingContext context; + private final RelationalMappingContext context; private final EntityInstantiators instantiators; private final DataAccessStrategy accessStrategy; private final RowMapperMap rowMapperMap; @@ -52,14 +52,14 @@ class JdbcQueryLookupStrategy implements QueryLookupStrategy { private final ConversionService conversionService; /** - * Creates a new {@link JdbcQueryLookupStrategy} for the given {@link JdbcMappingContext}, {@link DataAccessStrategy} + * Creates a new {@link JdbcQueryLookupStrategy} for the given {@link RelationalMappingContext}, {@link DataAccessStrategy} * and {@link RowMapperMap}. * * @param context must not be {@literal null}. * @param accessStrategy must not be {@literal null}. * @param rowMapperMap must not be {@literal null}. */ - JdbcQueryLookupStrategy(JdbcMappingContext context, EntityInstantiators instantiators, + JdbcQueryLookupStrategy(RelationalMappingContext context, EntityInstantiators instantiators, DataAccessStrategy accessStrategy, RowMapperMap rowMapperMap, NamedParameterJdbcOperations operations) { Assert.notNull(context, "JdbcMappingContext must not be null!"); diff --git a/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactory.java b/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactory.java index a59c3a69..539a1cb1 100644 --- a/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactory.java +++ b/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactory.java @@ -22,8 +22,8 @@ import org.springframework.data.convert.EntityInstantiators; import org.springframework.data.jdbc.core.DataAccessStrategy; import org.springframework.data.jdbc.core.JdbcAggregateTemplate; import org.springframework.data.jdbc.repository.RowMapperMap; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntity; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; import org.springframework.data.repository.core.EntityInformation; import org.springframework.data.repository.core.RepositoryInformation; import org.springframework.data.repository.core.RepositoryMetadata; @@ -45,7 +45,7 @@ import org.springframework.util.Assert; */ public class JdbcRepositoryFactory extends RepositoryFactorySupport { - private final JdbcMappingContext context; + private final RelationalMappingContext context; private final ApplicationEventPublisher publisher; private final DataAccessStrategy accessStrategy; private final NamedParameterJdbcOperations operations; @@ -54,7 +54,7 @@ public class JdbcRepositoryFactory extends RepositoryFactorySupport { private EntityInstantiators instantiators = new EntityInstantiators(); /** - * Creates a new {@link JdbcRepositoryFactory} for the given {@link DataAccessStrategy}, {@link JdbcMappingContext} + * Creates a new {@link JdbcRepositoryFactory} for the given {@link DataAccessStrategy}, {@link RelationalMappingContext} * and {@link ApplicationEventPublisher}. * * @param dataAccessStrategy must not be {@literal null}. @@ -62,7 +62,7 @@ public class JdbcRepositoryFactory extends RepositoryFactorySupport { * @param publisher must not be {@literal null}. * @param operations must not be {@literal null}. */ - public JdbcRepositoryFactory(DataAccessStrategy dataAccessStrategy, JdbcMappingContext context, + public JdbcRepositoryFactory(DataAccessStrategy dataAccessStrategy, RelationalMappingContext context, ApplicationEventPublisher publisher, NamedParameterJdbcOperations operations) { Assert.notNull(dataAccessStrategy, "DataAccessStrategy must not be null!"); @@ -101,7 +101,7 @@ public class JdbcRepositoryFactory extends RepositoryFactorySupport { @Override public EntityInformation getEntityInformation(Class aClass) { - JdbcPersistentEntity entity = context.getPersistentEntity(aClass); + RelationalPersistentEntity entity = context.getPersistentEntity(aClass); if (entity == null) { return null; diff --git a/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactoryBean.java b/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactoryBean.java index efbb218a..97351390 100644 --- a/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactoryBean.java +++ b/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactoryBean.java @@ -25,7 +25,7 @@ import org.springframework.data.jdbc.core.DataAccessStrategy; import org.springframework.data.jdbc.core.DefaultDataAccessStrategy; import org.springframework.data.jdbc.core.SqlGeneratorSource; import org.springframework.data.jdbc.repository.RowMapperMap; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; import org.springframework.data.repository.Repository; import org.springframework.data.repository.core.support.RepositoryFactorySupport; import org.springframework.data.repository.core.support.TransactionalRepositoryFactoryBeanSupport; @@ -46,7 +46,7 @@ public class JdbcRepositoryFactoryBean, S, ID extend extends TransactionalRepositoryFactoryBeanSupport implements ApplicationEventPublisherAware { private ApplicationEventPublisher publisher; - private JdbcMappingContext mappingContext; + private RelationalMappingContext mappingContext; private DataAccessStrategy dataAccessStrategy; private RowMapperMap rowMapperMap = RowMapperMap.EMPTY; private NamedParameterJdbcOperations operations; @@ -87,7 +87,7 @@ public class JdbcRepositoryFactoryBean, S, ID extend } @Autowired - protected void setMappingContext(JdbcMappingContext mappingContext) { + protected void setMappingContext(RelationalMappingContext mappingContext) { super.setMappingContext(mappingContext); this.mappingContext = mappingContext; diff --git a/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryQuery.java b/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryQuery.java index 9cd2ae09..14867abc 100644 --- a/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryQuery.java +++ b/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryQuery.java @@ -17,7 +17,7 @@ package org.springframework.data.jdbc.repository.support; import org.springframework.beans.BeanUtils; import org.springframework.dao.EmptyResultDataAccessException; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; import org.springframework.data.repository.query.RepositoryQuery; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; @@ -44,7 +44,7 @@ class JdbcRepositoryQuery implements RepositoryQuery { private final RowMapper rowMapper; /** - * Creates a new {@link JdbcRepositoryQuery} for the given {@link JdbcQueryMethod}, {@link JdbcMappingContext} and + * Creates a new {@link JdbcRepositoryQuery} for the given {@link JdbcQueryMethod}, {@link RelationalMappingContext} and * {@link RowMapper}. * * @param queryMethod must not be {@literal null}. diff --git a/src/main/java/org/springframework/data/relational/core/conversion/DbAction.java b/src/main/java/org/springframework/data/relational/core/conversion/DbAction.java index f915d6b0..f21ca008 100644 --- a/src/main/java/org/springframework/data/relational/core/conversion/DbAction.java +++ b/src/main/java/org/springframework/data/relational/core/conversion/DbAction.java @@ -47,7 +47,7 @@ public abstract class DbAction { /** * The path from the Aggregate Root to the entity affected by this {@link DbAction}. */ - private final JdbcPropertyPath propertyPath; + private final RelationalPropertyPath propertyPath; /** * Key-value-pairs to specify additional values to be used with the statement which can't be obtained from the entity, @@ -63,7 +63,7 @@ public abstract class DbAction { */ private final DbAction dependingOn; - private DbAction(Class entityType, @Nullable T entity, @Nullable JdbcPropertyPath propertyPath, + private DbAction(Class entityType, @Nullable T entity, @Nullable RelationalPropertyPath propertyPath, @Nullable DbAction dependingOn) { Assert.notNull(entityType, "entityType must not be null"); @@ -84,7 +84,7 @@ public abstract class DbAction { * @param the type of the entity to be inserted. * @return a {@link DbAction} representing the insert. */ - public static Insert insert(T entity, JdbcPropertyPath propertyPath, @Nullable DbAction dependingOn) { + public static Insert insert(T entity, RelationalPropertyPath propertyPath, @Nullable DbAction dependingOn) { return new Insert<>(entity, propertyPath, dependingOn); } @@ -98,7 +98,7 @@ public abstract class DbAction { * @param the type of the entity to be updated. * @return a {@link DbAction} representing the update. */ - public static Update update(T entity, JdbcPropertyPath propertyPath, @Nullable DbAction dependingOn) { + public static Update update(T entity, RelationalPropertyPath propertyPath, @Nullable DbAction dependingOn) { return new Update<>(entity, propertyPath, dependingOn); } @@ -114,7 +114,7 @@ public abstract class DbAction { * @return a {@link DbAction} representing the deletion of the entity with given type and id. */ public static Delete delete(Object id, Class type, @Nullable T entity, - @Nullable JdbcPropertyPath propertyPath, @Nullable DbAction dependingOn) { + @Nullable RelationalPropertyPath propertyPath, @Nullable DbAction dependingOn) { return new Delete<>(id, type, entity, propertyPath, dependingOn); } @@ -129,7 +129,7 @@ public abstract class DbAction { * @return a {@link DbAction} representing the deletion of all entities of a given type belonging to a specific type * of aggregate root. */ - public static DeleteAll deleteAll(Class type, @Nullable JdbcPropertyPath propertyPath, + public static DeleteAll deleteAll(Class type, @Nullable RelationalPropertyPath propertyPath, @Nullable DbAction dependingOn) { return new DeleteAll<>(type, propertyPath, dependingOn); } @@ -163,7 +163,7 @@ public abstract class DbAction { abstract static class InsertOrUpdate extends DbAction { @SuppressWarnings("unchecked") - InsertOrUpdate(T entity, JdbcPropertyPath propertyPath, @Nullable DbAction dependingOn) { + InsertOrUpdate(T entity, RelationalPropertyPath propertyPath, @Nullable DbAction dependingOn) { super((Class) entity.getClass(), entity, propertyPath, dependingOn); } } @@ -175,7 +175,7 @@ public abstract class DbAction { */ public static class Insert extends InsertOrUpdate { - private Insert(T entity, JdbcPropertyPath propertyPath, @Nullable DbAction dependingOn) { + private Insert(T entity, RelationalPropertyPath propertyPath, @Nullable DbAction dependingOn) { super(entity, propertyPath, dependingOn); } @@ -192,7 +192,7 @@ public abstract class DbAction { */ public static class Update extends InsertOrUpdate { - private Update(T entity, JdbcPropertyPath propertyPath, @Nullable DbAction dependingOn) { + private Update(T entity, RelationalPropertyPath propertyPath, @Nullable DbAction dependingOn) { super(entity, propertyPath, dependingOn); } @@ -216,7 +216,7 @@ public abstract class DbAction { */ private final Object rootId; - private Delete(@Nullable Object rootId, Class type, @Nullable T entity, @Nullable JdbcPropertyPath propertyPath, + private Delete(@Nullable Object rootId, Class type, @Nullable T entity, @Nullable RelationalPropertyPath propertyPath, @Nullable DbAction dependingOn) { super(type, entity, propertyPath, dependingOn); @@ -239,7 +239,7 @@ public abstract class DbAction { */ public static class DeleteAll extends DbAction { - private DeleteAll(Class entityType, @Nullable JdbcPropertyPath propertyPath, @Nullable DbAction dependingOn) { + private DeleteAll(Class entityType, @Nullable RelationalPropertyPath propertyPath, @Nullable DbAction dependingOn) { super(entityType, null, propertyPath, dependingOn); } diff --git a/src/main/java/org/springframework/data/relational/core/conversion/JdbcEntityDeleteWriter.java b/src/main/java/org/springframework/data/relational/core/conversion/RelationalEntityDeleteWriter.java similarity index 88% rename from src/main/java/org/springframework/data/relational/core/conversion/JdbcEntityDeleteWriter.java rename to src/main/java/org/springframework/data/relational/core/conversion/RelationalEntityDeleteWriter.java index 7ecfdba2..fdaaf121 100644 --- a/src/main/java/org/springframework/data/relational/core/conversion/JdbcEntityDeleteWriter.java +++ b/src/main/java/org/springframework/data/relational/core/conversion/RelationalEntityDeleteWriter.java @@ -15,7 +15,7 @@ */ package org.springframework.data.relational.core.conversion; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; import org.springframework.lang.Nullable; /** @@ -25,9 +25,9 @@ import org.springframework.lang.Nullable; * @author Jens Schauder * @since 1.0 */ -public class JdbcEntityDeleteWriter extends JdbcEntityWriterSupport { +public class RelationalEntityDeleteWriter extends RelationalEntityWriterSupport { - public JdbcEntityDeleteWriter(JdbcMappingContext context) { + public RelationalEntityDeleteWriter(RelationalMappingContext context) { super(context); } @@ -52,7 +52,7 @@ public class JdbcEntityDeleteWriter extends JdbcEntityWriterSupport { private void deleteAll(AggregateChange aggregateChange) { context.referencedEntities(aggregateChange.getEntityType(), null) - .forEach(p -> aggregateChange.addAction(DbAction.deleteAll(p.getLeafType(), new JdbcPropertyPath(p), null))); + .forEach(p -> aggregateChange.addAction(DbAction.deleteAll(p.getLeafType(), new RelationalPropertyPath(p), null))); aggregateChange.addAction(DbAction.deleteAll(aggregateChange.getEntityType(), null, null)); } diff --git a/src/main/java/org/springframework/data/relational/core/conversion/JdbcEntityWriter.java b/src/main/java/org/springframework/data/relational/core/conversion/RelationalEntityWriter.java similarity index 80% rename from src/main/java/org/springframework/data/relational/core/conversion/JdbcEntityWriter.java rename to src/main/java/org/springframework/data/relational/core/conversion/RelationalEntityWriter.java index 9fff8532..d6d1751f 100644 --- a/src/main/java/org/springframework/data/relational/core/conversion/JdbcEntityWriter.java +++ b/src/main/java/org/springframework/data/relational/core/conversion/RelationalEntityWriter.java @@ -29,9 +29,9 @@ import org.springframework.data.mapping.PersistentProperty; import org.springframework.data.mapping.PersistentPropertyAccessor; import org.springframework.data.relational.core.conversion.DbAction.Insert; import org.springframework.data.relational.core.conversion.DbAction.Update; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntity; -import org.springframework.data.relational.core.mapping.JdbcPersistentProperty; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; +import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; import org.springframework.data.util.StreamUtils; /** @@ -41,11 +41,11 @@ import org.springframework.data.util.StreamUtils; * @author Jens Schauder * @since 1.0 */ -public class JdbcEntityWriter extends JdbcEntityWriterSupport { +public class RelationalEntityWriter extends RelationalEntityWriterSupport { - private final JdbcMappingContext context; + private final RelationalMappingContext context; - public JdbcEntityWriter(JdbcMappingContext context) { + public RelationalEntityWriter(RelationalMappingContext context) { super(context); @@ -63,9 +63,9 @@ public class JdbcEntityWriter extends JdbcEntityWriterSupport { public void write(Object aggregateRoot, AggregateChange aggregateChange) { Class type = aggregateRoot.getClass(); - JdbcPropertyPath propertyPath = JdbcPropertyPath.from("", type); + RelationalPropertyPath propertyPath = RelationalPropertyPath.from("", type); - PersistentEntity persistentEntity = context.getRequiredPersistentEntity(type); + PersistentEntity persistentEntity = context.getRequiredPersistentEntity(type); if (persistentEntity.isNew(aggregateRoot)) { @@ -83,7 +83,7 @@ public class JdbcEntityWriter extends JdbcEntityWriterSupport { ); } else { - JdbcPersistentEntity entity = context.getRequiredPersistentEntity(type); + RelationalPersistentEntity entity = context.getRequiredPersistentEntity(type); IdentifierAccessor identifierAccessor = entity.getIdentifierAccessor(aggregateRoot); deleteReferencedEntities(identifierAccessor.getRequiredIdentifier(), aggregateChange); @@ -97,7 +97,7 @@ public class JdbcEntityWriter extends JdbcEntityWriterSupport { } private void insertReferencedEntities(PropertyAndValue propertyAndValue, AggregateChange aggregateChange, - JdbcPropertyPath propertyPath, DbAction dependingOn) { + RelationalPropertyPath propertyPath, DbAction dependingOn) { Insert insert; if (propertyAndValue.property.isQualified()) { @@ -121,7 +121,7 @@ public class JdbcEntityWriter extends JdbcEntityWriterSupport { private Stream referencedEntities(Object o) { - JdbcPersistentEntity persistentEntity = context.getRequiredPersistentEntity(o.getClass()); + RelationalPersistentEntity persistentEntity = context.getRequiredPersistentEntity(o.getClass()); return StreamUtils.createStreamFromIterator(persistentEntity.iterator()) // .filter(PersistentProperty::isEntity) // @@ -131,10 +131,10 @@ public class JdbcEntityWriter extends JdbcEntityWriterSupport { ); } - private Stream referencedEntity(JdbcPersistentProperty p, PersistentPropertyAccessor propertyAccessor) { + private Stream referencedEntity(RelationalPersistentProperty p, PersistentPropertyAccessor propertyAccessor) { Class actualType = p.getActualType(); - JdbcPersistentEntity persistentEntity = context // + RelationalPersistentEntity persistentEntity = context // .getPersistentEntity(actualType); if (persistentEntity == null) { @@ -159,7 +159,7 @@ public class JdbcEntityWriter extends JdbcEntityWriterSupport { } @SuppressWarnings("unchecked") - private Stream collectionPropertyAsStream(JdbcPersistentProperty p, + private Stream collectionPropertyAsStream(RelationalPersistentProperty p, PersistentPropertyAccessor propertyAccessor) { Object property = propertyAccessor.getProperty(p); @@ -170,7 +170,7 @@ public class JdbcEntityWriter extends JdbcEntityWriterSupport { } @SuppressWarnings("unchecked") - private Stream listPropertyAsStream(JdbcPersistentProperty p, PersistentPropertyAccessor propertyAccessor) { + private Stream listPropertyAsStream(RelationalPersistentProperty p, PersistentPropertyAccessor propertyAccessor) { Object property = propertyAccessor.getProperty(p); @@ -186,7 +186,7 @@ public class JdbcEntityWriter extends JdbcEntityWriterSupport { } @SuppressWarnings("unchecked") - private Stream mapPropertyAsStream(JdbcPersistentProperty p, PersistentPropertyAccessor propertyAccessor) { + private Stream mapPropertyAsStream(RelationalPersistentProperty p, PersistentPropertyAccessor propertyAccessor) { Object property = propertyAccessor.getProperty(p); @@ -195,7 +195,7 @@ public class JdbcEntityWriter extends JdbcEntityWriterSupport { : ((Map) property).entrySet().stream().map(e -> new KeyValue(e.getKey(), e.getValue())); } - private Stream singlePropertyAsStream(JdbcPersistentProperty p, PersistentPropertyAccessor propertyAccessor) { + private Stream singlePropertyAsStream(RelationalPersistentProperty p, PersistentPropertyAccessor propertyAccessor) { Object property = propertyAccessor.getProperty(p); if (property == null) { @@ -217,7 +217,7 @@ public class JdbcEntityWriter extends JdbcEntityWriterSupport { @Data private static class PropertyAndValue { - private final JdbcPersistentProperty property; + private final RelationalPersistentProperty property; private final Object value; } } diff --git a/src/main/java/org/springframework/data/relational/core/conversion/JdbcEntityWriterSupport.java b/src/main/java/org/springframework/data/relational/core/conversion/RelationalEntityWriterSupport.java similarity index 82% rename from src/main/java/org/springframework/data/relational/core/conversion/JdbcEntityWriterSupport.java rename to src/main/java/org/springframework/data/relational/core/conversion/RelationalEntityWriterSupport.java index b908b89c..a338634d 100644 --- a/src/main/java/org/springframework/data/relational/core/conversion/JdbcEntityWriterSupport.java +++ b/src/main/java/org/springframework/data/relational/core/conversion/RelationalEntityWriterSupport.java @@ -16,7 +16,7 @@ package org.springframework.data.relational.core.conversion; import org.springframework.data.convert.EntityWriter; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; import org.springframework.util.Assert; /** @@ -25,10 +25,10 @@ import org.springframework.util.Assert; * @author Jens Schauder * @since 1.0 */ -abstract class JdbcEntityWriterSupport implements EntityWriter> { - protected final JdbcMappingContext context; +abstract class RelationalEntityWriterSupport implements EntityWriter> { + protected final RelationalMappingContext context; - JdbcEntityWriterSupport(JdbcMappingContext context) { + RelationalEntityWriterSupport(RelationalMappingContext context) { Assert.notNull(context, "Context must not be null"); @@ -45,6 +45,6 @@ abstract class JdbcEntityWriterSupport implements EntityWriter aggregateChange) { context.referencedEntities(aggregateChange.getEntityType(), null).forEach( - p -> aggregateChange.addAction(DbAction.delete(id, p.getLeafType(), null, new JdbcPropertyPath(p), null))); + p -> aggregateChange.addAction(DbAction.delete(id, p.getLeafType(), null, new RelationalPropertyPath(p), null))); } } diff --git a/src/main/java/org/springframework/data/relational/core/conversion/JdbcPropertyPath.java b/src/main/java/org/springframework/data/relational/core/conversion/RelationalPropertyPath.java similarity index 76% rename from src/main/java/org/springframework/data/relational/core/conversion/JdbcPropertyPath.java rename to src/main/java/org/springframework/data/relational/core/conversion/RelationalPropertyPath.java index 760a29b5..d724e794 100644 --- a/src/main/java/org/springframework/data/relational/core/conversion/JdbcPropertyPath.java +++ b/src/main/java/org/springframework/data/relational/core/conversion/RelationalPropertyPath.java @@ -26,12 +26,12 @@ import org.springframework.util.StringUtils; * @author Jens Schauder * @since 1.0 */ -public class JdbcPropertyPath { +public class RelationalPropertyPath { private final PropertyPath path; private final Class rootType; - JdbcPropertyPath(PropertyPath path) { + RelationalPropertyPath(PropertyPath path) { Assert.notNull(path, "path must not be null if rootType is not set"); @@ -39,7 +39,7 @@ public class JdbcPropertyPath { this.rootType = null; } - private JdbcPropertyPath(Class type) { + private RelationalPropertyPath(Class type) { Assert.notNull(type, "type must not be null if path is not set"); @@ -47,20 +47,20 @@ public class JdbcPropertyPath { this.rootType = type; } - public static JdbcPropertyPath from(String source, Class type) { + public static RelationalPropertyPath from(String source, Class type) { if (StringUtils.isEmpty(source)) { - return new JdbcPropertyPath(type); + return new RelationalPropertyPath(type); } else { - return new JdbcPropertyPath(PropertyPath.from(source, type)); + return new RelationalPropertyPath(PropertyPath.from(source, type)); } } - public JdbcPropertyPath nested(String name) { + public RelationalPropertyPath nested(String name) { return path == null ? // - new JdbcPropertyPath(PropertyPath.from(name, rootType)) // - : new JdbcPropertyPath(path.nested(name)); + new RelationalPropertyPath(PropertyPath.from(name, rootType)) // + : new RelationalPropertyPath(path.nested(name)); } public PropertyPath getPath() { diff --git a/src/main/java/org/springframework/data/relational/core/mapping/BasicJdbcPersistentProperty.java b/src/main/java/org/springframework/data/relational/core/mapping/BasicRelationalPersistentProperty.java similarity index 84% rename from src/main/java/org/springframework/data/relational/core/mapping/BasicJdbcPersistentProperty.java rename to src/main/java/org/springframework/data/relational/core/mapping/BasicRelationalPersistentProperty.java index cae32cef..0f747dc2 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/BasicJdbcPersistentProperty.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/BasicRelationalPersistentProperty.java @@ -40,8 +40,8 @@ import org.springframework.util.ClassUtils; * @author Greg Turnquist * @since 1.0 */ -class BasicJdbcPersistentProperty extends AnnotationBasedPersistentProperty - implements JdbcPersistentProperty { +class BasicRelationalPersistentProperty extends AnnotationBasedPersistentProperty + implements RelationalPersistentProperty { private static final Map, Class> javaToDbType = new LinkedHashMap<>(); @@ -51,7 +51,7 @@ class BasicJdbcPersistentProperty extends AnnotationBasedPersistentProperty> columnName; /** @@ -62,8 +62,8 @@ class BasicJdbcPersistentProperty extends AnnotationBasedPersistentProperty owner, - SimpleTypeHolder simpleTypeHolder, JdbcMappingContext context) { + public BasicRelationalPersistentProperty(Property property, PersistentEntity owner, + SimpleTypeHolder simpleTypeHolder, RelationalMappingContext context) { super(property, owner, simpleTypeHolder); @@ -78,7 +78,7 @@ class BasicJdbcPersistentProperty extends AnnotationBasedPersistentProperty createAssociation() { + protected Association createAssociation() { throw new UnsupportedOperationException(); } @@ -106,8 +106,8 @@ class BasicJdbcPersistentProperty extends AnnotationBasedPersistentProperty getOwner() { - return (JdbcPersistentEntity) super.getOwner(); + public RelationalPersistentEntity getOwner() { + return (RelationalPersistentEntity) super.getOwner(); } @Override @@ -137,13 +137,13 @@ class BasicJdbcPersistentProperty extends AnnotationBasedPersistentProperty persistentEntity = context.getPersistentEntity(type); + RelationalPersistentEntity persistentEntity = context.getPersistentEntity(type); if (persistentEntity == null) { return null; } - JdbcPersistentProperty idProperty = persistentEntity.getIdProperty(); + RelationalPersistentProperty idProperty = persistentEntity.getIdProperty(); if (idProperty == null) { return null; diff --git a/src/main/java/org/springframework/data/relational/core/mapping/NamingStrategy.java b/src/main/java/org/springframework/data/relational/core/mapping/NamingStrategy.java index 093e0273..4ffbe2fc 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/NamingStrategy.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/NamingStrategy.java @@ -20,7 +20,7 @@ import org.springframework.util.Assert; /** * Interface and default implementation of a naming strategy. Defaults to no schema, table name based on {@link Class} - * and column name based on {@link JdbcPersistentProperty} with name parts of both separated by '_'. + * and column name based on {@link RelationalPersistentProperty} with name parts of both separated by '_'. *

* NOTE: Can also be used as an adapter. Create a lambda or an anonymous subclass and override any settings to implement * a different strategy on the fly. @@ -62,10 +62,10 @@ public interface NamingStrategy { } /** - * Defaults to return the given {@link JdbcPersistentProperty}'s name with the parts of a camel case name separated by + * Defaults to return the given {@link RelationalPersistentProperty}'s name with the parts of a camel case name separated by * '_'; */ - default String getColumnName(JdbcPersistentProperty property) { + default String getColumnName(RelationalPersistentProperty property) { Assert.notNull(property, "Property must not be null."); @@ -82,7 +82,7 @@ public interface NamingStrategy { * @param property The property who's column name in the owner table is required * @return a column name. Must not be {@code null}. */ - default String getReverseColumnName(JdbcPersistentProperty property) { + default String getReverseColumnName(RelationalPersistentProperty property) { Assert.notNull(property, "Property must not be null."); @@ -95,7 +95,7 @@ public interface NamingStrategy { * * @return name of the key column. Must not be {@code null}. */ - default String getKeyColumn(JdbcPersistentProperty property) { + default String getKeyColumn(RelationalPersistentProperty property) { Assert.notNull(property, "Property must not be null."); diff --git a/src/main/java/org/springframework/data/relational/core/mapping/JdbcMappingContext.java b/src/main/java/org/springframework/data/relational/core/mapping/RelationalMappingContext.java similarity index 80% rename from src/main/java/org/springframework/data/relational/core/mapping/JdbcMappingContext.java rename to src/main/java/org/springframework/data/relational/core/mapping/RelationalMappingContext.java index b737bcb0..78a2bb6e 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/JdbcMappingContext.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/RelationalMappingContext.java @@ -49,7 +49,7 @@ import org.springframework.util.Assert; * @author Oliver Gierke * @since 1.0 */ -public class JdbcMappingContext extends AbstractMappingContext, JdbcPersistentProperty> { +public class RelationalMappingContext extends AbstractMappingContext, RelationalPersistentProperty> { private static final HashSet> CUSTOM_SIMPLE_TYPES = new HashSet<>(asList( // BigDecimal.class, // @@ -62,23 +62,23 @@ public class JdbcMappingContext extends AbstractMappingContext paths = new ArrayList<>(); Class currentType = path == null ? rootType : path.getLeafType(); - JdbcPersistentEntity persistentEntity = getRequiredPersistentEntity(currentType); + RelationalPersistentEntity persistentEntity = getRequiredPersistentEntity(currentType); - for (JdbcPersistentProperty property : persistentEntity) { + for (RelationalPersistentProperty property : persistentEntity) { if (property.isEntity()) { PropertyPath nextPath = path == null ? PropertyPath.from(property.getName(), rootType) @@ -134,8 +134,8 @@ public class JdbcMappingContext extends AbstractMappingContext JdbcPersistentEntity createPersistentEntity(TypeInformation typeInformation) { - return new JdbcPersistentEntityImpl<>(typeInformation, this.namingStrategy); + protected RelationalPersistentEntity createPersistentEntity(TypeInformation typeInformation) { + return new RelationalPersistentEntityImpl<>(typeInformation, this.namingStrategy); } /* @@ -143,9 +143,9 @@ public class JdbcMappingContext extends AbstractMappingContext owner, + protected RelationalPersistentProperty createPersistentProperty(Property property, RelationalPersistentEntity owner, SimpleTypeHolder simpleTypeHolder) { - return new BasicJdbcPersistentProperty(property, owner, simpleTypeHolder, this); + return new BasicRelationalPersistentProperty(property, owner, simpleTypeHolder, this); } public ConversionService getConversions() { diff --git a/src/main/java/org/springframework/data/relational/core/mapping/JdbcPersistentEntity.java b/src/main/java/org/springframework/data/relational/core/mapping/RelationalPersistentEntity.java similarity index 91% rename from src/main/java/org/springframework/data/relational/core/mapping/JdbcPersistentEntity.java rename to src/main/java/org/springframework/data/relational/core/mapping/RelationalPersistentEntity.java index d07f7bb6..366a61dd 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/JdbcPersistentEntity.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/RelationalPersistentEntity.java @@ -25,7 +25,7 @@ import org.springframework.data.mapping.model.MutablePersistentEntity; * @author Oliver Gierke * @since 1.0 */ -public interface JdbcPersistentEntity extends MutablePersistentEntity { +public interface RelationalPersistentEntity extends MutablePersistentEntity { /** * Returns the name of the table backing the given entity. diff --git a/src/main/java/org/springframework/data/relational/core/mapping/JdbcPersistentEntityImpl.java b/src/main/java/org/springframework/data/relational/core/mapping/RelationalPersistentEntityImpl.java similarity index 85% rename from src/main/java/org/springframework/data/relational/core/mapping/JdbcPersistentEntityImpl.java rename to src/main/java/org/springframework/data/relational/core/mapping/RelationalPersistentEntityImpl.java index 5abe3ae7..ce9474ef 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/JdbcPersistentEntityImpl.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/RelationalPersistentEntityImpl.java @@ -28,18 +28,18 @@ import org.springframework.data.util.TypeInformation; * @author Greg Turnquist * @since 1.0 */ -class JdbcPersistentEntityImpl extends BasicPersistentEntity - implements JdbcPersistentEntity { +class RelationalPersistentEntityImpl extends BasicPersistentEntity + implements RelationalPersistentEntity { private final NamingStrategy namingStrategy; private final Lazy> tableName; /** - * Creates a new {@link JdbcPersistentEntityImpl} for the given {@link TypeInformation}. + * Creates a new {@link RelationalPersistentEntityImpl} for the given {@link TypeInformation}. * * @param information must not be {@literal null}. */ - JdbcPersistentEntityImpl(TypeInformation information, NamingStrategy namingStrategy) { + RelationalPersistentEntityImpl(TypeInformation information, NamingStrategy namingStrategy) { super(information); diff --git a/src/main/java/org/springframework/data/relational/core/mapping/JdbcPersistentProperty.java b/src/main/java/org/springframework/data/relational/core/mapping/RelationalPersistentProperty.java similarity index 91% rename from src/main/java/org/springframework/data/relational/core/mapping/JdbcPersistentProperty.java rename to src/main/java/org/springframework/data/relational/core/mapping/RelationalPersistentProperty.java index 54e4e493..b6014893 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/JdbcPersistentProperty.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/RelationalPersistentProperty.java @@ -25,7 +25,7 @@ import org.springframework.lang.Nullable; * @author Oliver Gierke * @since 1.0 */ -public interface JdbcPersistentProperty extends PersistentProperty { +public interface RelationalPersistentProperty extends PersistentProperty { /** * Returns the name of the column backing this property. @@ -42,7 +42,7 @@ public interface JdbcPersistentProperty extends PersistentProperty getColumnType(); @Override - JdbcPersistentEntity getOwner(); + RelationalPersistentEntity getOwner(); String getReverseColumnName(); diff --git a/src/main/java/org/springframework/data/relational/core/mapping/event/AfterDeleteEvent.java b/src/main/java/org/springframework/data/relational/core/mapping/event/AfterDeleteEvent.java index 691d4c83..ad91b7d7 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/event/AfterDeleteEvent.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/event/AfterDeleteEvent.java @@ -27,7 +27,7 @@ import org.springframework.data.relational.core.mapping.event.Identifier.Specifi * @author Jens Schauder * @since 1.0 */ -public class AfterDeleteEvent extends JdbcEventWithId { +public class AfterDeleteEvent extends RelationalEventWithId { private static final long serialVersionUID = 3594807189931141582L; diff --git a/src/main/java/org/springframework/data/relational/core/mapping/event/AfterLoadEvent.java b/src/main/java/org/springframework/data/relational/core/mapping/event/AfterLoadEvent.java index 528fb103..9af1ad95 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/event/AfterLoadEvent.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/event/AfterLoadEvent.java @@ -24,7 +24,7 @@ import org.springframework.data.relational.core.mapping.event.Identifier.Specifi * @author Jens Schauder * @since 1.0 */ -public class AfterLoadEvent extends JdbcEventWithIdAndEntity { +public class AfterLoadEvent extends RelationalEventWithIdAndEntity { private static final long serialVersionUID = -4185777271143436728L; diff --git a/src/main/java/org/springframework/data/relational/core/mapping/event/AfterSaveEvent.java b/src/main/java/org/springframework/data/relational/core/mapping/event/AfterSaveEvent.java index a19ded42..cc651f8f 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/event/AfterSaveEvent.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/event/AfterSaveEvent.java @@ -24,7 +24,7 @@ import org.springframework.data.relational.core.mapping.event.Identifier.Specifi * @author Jens Schauder * @since 1.0 */ -public class AfterSaveEvent extends JdbcEventWithIdAndEntity { +public class AfterSaveEvent extends RelationalEventWithIdAndEntity { private static final long serialVersionUID = 8982085767296982848L; diff --git a/src/main/java/org/springframework/data/relational/core/mapping/event/BeforeDeleteEvent.java b/src/main/java/org/springframework/data/relational/core/mapping/event/BeforeDeleteEvent.java index 6e37cfbe..267529a7 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/event/BeforeDeleteEvent.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/event/BeforeDeleteEvent.java @@ -27,7 +27,7 @@ import org.springframework.data.relational.core.mapping.event.Identifier.Specifi * @author Jens Schauder * @since 1.0 */ -public class BeforeDeleteEvent extends JdbcEventWithId { +public class BeforeDeleteEvent extends RelationalEventWithId { private static final long serialVersionUID = -5483432053368496651L; diff --git a/src/main/java/org/springframework/data/relational/core/mapping/event/BeforeSaveEvent.java b/src/main/java/org/springframework/data/relational/core/mapping/event/BeforeSaveEvent.java index 71de990d..cb0b9931 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/event/BeforeSaveEvent.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/event/BeforeSaveEvent.java @@ -24,7 +24,7 @@ import org.springframework.data.relational.core.conversion.AggregateChange; * @author Jens Schauder * @since 1.0 */ -public class BeforeSaveEvent extends JdbcEventWithEntity { +public class BeforeSaveEvent extends RelationalEventWithEntity { private static final long serialVersionUID = -6996874391990315443L; diff --git a/src/main/java/org/springframework/data/relational/core/mapping/event/JdbcEvent.java b/src/main/java/org/springframework/data/relational/core/mapping/event/RelationalEvent.java similarity index 97% rename from src/main/java/org/springframework/data/relational/core/mapping/event/JdbcEvent.java rename to src/main/java/org/springframework/data/relational/core/mapping/event/RelationalEvent.java index fb611ebb..1cd38f73 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/event/JdbcEvent.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/event/RelationalEvent.java @@ -24,7 +24,7 @@ import java.util.Optional; * @author Oliver Gierke * @since 1.0 */ -public interface JdbcEvent { +public interface RelationalEvent { /** * The identifier of the aggregate root, triggering this event. diff --git a/src/main/java/org/springframework/data/relational/core/mapping/event/JdbcEventWithEntity.java b/src/main/java/org/springframework/data/relational/core/mapping/event/RelationalEventWithEntity.java similarity index 79% rename from src/main/java/org/springframework/data/relational/core/mapping/event/JdbcEventWithEntity.java rename to src/main/java/org/springframework/data/relational/core/mapping/event/RelationalEventWithEntity.java index 681854dd..725d5f78 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/event/JdbcEventWithEntity.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/event/RelationalEventWithEntity.java @@ -20,16 +20,16 @@ import java.util.Optional; import org.springframework.data.relational.core.conversion.AggregateChange; /** - * A {@link SimpleJdbcEvent} which is guaranteed to have an entity. + * A {@link SimpleRelationalEvent} which is guaranteed to have an entity. * * @author Jens Schauder * @since 1.0 */ -public class JdbcEventWithEntity extends SimpleJdbcEvent implements WithEntity { +public class RelationalEventWithEntity extends SimpleRelationalEvent implements WithEntity { private static final long serialVersionUID = 4891455396602090638L; - JdbcEventWithEntity(Identifier id, Object entity, AggregateChange change) { + RelationalEventWithEntity(Identifier id, Object entity, AggregateChange change) { super(id, Optional.of(entity), change); } } diff --git a/src/main/java/org/springframework/data/relational/core/mapping/event/JdbcEventWithId.java b/src/main/java/org/springframework/data/relational/core/mapping/event/RelationalEventWithId.java similarity index 83% rename from src/main/java/org/springframework/data/relational/core/mapping/event/JdbcEventWithId.java rename to src/main/java/org/springframework/data/relational/core/mapping/event/RelationalEventWithId.java index 44761cb0..2559667e 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/event/JdbcEventWithId.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/event/RelationalEventWithId.java @@ -22,18 +22,18 @@ import org.springframework.data.relational.core.mapping.event.Identifier.Specifi import org.springframework.lang.Nullable; /** - * A {@link SimpleJdbcEvent} guaranteed to have an identifier. + * A {@link SimpleRelationalEvent} guaranteed to have an identifier. * * @author Jens Schauder * @since 1.0 */ -public class JdbcEventWithId extends SimpleJdbcEvent implements WithId { +public class RelationalEventWithId extends SimpleRelationalEvent implements WithId { private static final long serialVersionUID = -8071323168471611098L; private final Specified id; - public JdbcEventWithId(Specified id, Optional entity, @Nullable AggregateChange change) { + public RelationalEventWithId(Specified id, Optional entity, @Nullable AggregateChange change) { super(id, entity, change); diff --git a/src/main/java/org/springframework/data/relational/core/mapping/event/JdbcEventWithIdAndEntity.java b/src/main/java/org/springframework/data/relational/core/mapping/event/RelationalEventWithIdAndEntity.java similarity index 79% rename from src/main/java/org/springframework/data/relational/core/mapping/event/JdbcEventWithIdAndEntity.java rename to src/main/java/org/springframework/data/relational/core/mapping/event/RelationalEventWithIdAndEntity.java index 8cc4ef86..a4a3f6f4 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/event/JdbcEventWithIdAndEntity.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/event/RelationalEventWithIdAndEntity.java @@ -24,17 +24,17 @@ import org.springframework.data.relational.core.mapping.event.Identifier.Specifi import org.springframework.lang.Nullable; /** - * A {@link SimpleJdbcEvent} which is guaranteed to have an identifier and an entity. + * A {@link SimpleRelationalEvent} which is guaranteed to have an identifier and an entity. * * @author Jens Schauder * @since 1.0 */ @Getter -public class JdbcEventWithIdAndEntity extends JdbcEventWithId implements WithEntity { +public class RelationalEventWithIdAndEntity extends RelationalEventWithId implements WithEntity { private static final long serialVersionUID = -3194462549552515519L; - public JdbcEventWithIdAndEntity(Specified id, Object entity, @Nullable AggregateChange change) { + public RelationalEventWithIdAndEntity(Specified id, Object entity, @Nullable AggregateChange change) { super(id, Optional.of(entity), change); } } diff --git a/src/main/java/org/springframework/data/relational/core/mapping/event/SimpleJdbcEvent.java b/src/main/java/org/springframework/data/relational/core/mapping/event/SimpleRelationalEvent.java similarity index 90% rename from src/main/java/org/springframework/data/relational/core/mapping/event/SimpleJdbcEvent.java rename to src/main/java/org/springframework/data/relational/core/mapping/event/SimpleRelationalEvent.java index 960d7310..79dc06f5 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/event/SimpleJdbcEvent.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/event/SimpleRelationalEvent.java @@ -29,14 +29,14 @@ import org.springframework.lang.Nullable; * @author Oliver Gierke * @since 1.0 */ -class SimpleJdbcEvent extends ApplicationEvent implements JdbcEvent { +class SimpleRelationalEvent extends ApplicationEvent implements RelationalEvent { private static final long serialVersionUID = -1798807778668751659L; private final Object entity; private final AggregateChange change; - SimpleJdbcEvent(Identifier id, Optional entity, @Nullable AggregateChange change) { + SimpleRelationalEvent(Identifier id, Optional entity, @Nullable AggregateChange change) { super(id); diff --git a/src/main/java/org/springframework/data/relational/core/mapping/event/WithEntity.java b/src/main/java/org/springframework/data/relational/core/mapping/event/WithEntity.java index 1cd6e923..ce3bb958 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/event/WithEntity.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/event/WithEntity.java @@ -16,13 +16,13 @@ package org.springframework.data.relational.core.mapping.event; /** - * Interface for {@link SimpleJdbcEvent}s which are guaranteed to have an entity. Allows direct access to that entity, + * Interface for {@link SimpleRelationalEvent}s which are guaranteed to have an entity. Allows direct access to that entity, * without going through an {@link java.util.Optional} * * @author Jens Schauder * @since 1.0 */ -public interface WithEntity extends JdbcEvent { +public interface WithEntity extends RelationalEvent { /** * @return will never be {@literal null}. diff --git a/src/main/java/org/springframework/data/relational/core/mapping/event/WithId.java b/src/main/java/org/springframework/data/relational/core/mapping/event/WithId.java index a3910f27..0063d023 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/event/WithId.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/event/WithId.java @@ -18,13 +18,13 @@ package org.springframework.data.relational.core.mapping.event; import org.springframework.data.relational.core.mapping.event.Identifier.Specified; /** - * Interface for {@link SimpleJdbcEvent}s which are guaranteed to have a {@link Specified} identifier. Offers direct + * Interface for {@link SimpleRelationalEvent}s which are guaranteed to have a {@link Specified} identifier. Offers direct * access to the {@link Specified} identifier. * * @author Jens Schauder * @since 1.0 */ -public interface WithId extends JdbcEvent { +public interface WithId extends RelationalEvent { /** * Events with an identifier will always return a {@link Specified} one. diff --git a/src/main/java/org/springframework/data/relational/domain/support/JdbcAuditingEventListener.java b/src/main/java/org/springframework/data/relational/domain/support/RelationalAuditingEventListener.java similarity index 94% rename from src/main/java/org/springframework/data/relational/domain/support/JdbcAuditingEventListener.java rename to src/main/java/org/springframework/data/relational/domain/support/RelationalAuditingEventListener.java index d78f69cb..17b748f3 100644 --- a/src/main/java/org/springframework/data/relational/domain/support/JdbcAuditingEventListener.java +++ b/src/main/java/org/springframework/data/relational/domain/support/RelationalAuditingEventListener.java @@ -34,7 +34,7 @@ import org.springframework.data.relational.core.mapping.event.BeforeSaveEvent; * @since 1.0 */ @RequiredArgsConstructor -public class JdbcAuditingEventListener implements ApplicationListener { +public class RelationalAuditingEventListener implements ApplicationListener { private final IsNewAwareAuditingHandler handler; diff --git a/src/test/java/org/springframework/data/jdbc/core/CascadingDataAccessStrategyUnitTests.java b/src/test/java/org/springframework/data/jdbc/core/CascadingDataAccessStrategyUnitTests.java index 9f5ac890..5c56a960 100644 --- a/src/test/java/org/springframework/data/jdbc/core/CascadingDataAccessStrategyUnitTests.java +++ b/src/test/java/org/springframework/data/jdbc/core/CascadingDataAccessStrategyUnitTests.java @@ -25,7 +25,7 @@ import java.util.Collections; import org.junit.Test; import org.springframework.data.jdbc.core.FunctionCollector.CombinedDataAccessException; -import org.springframework.data.relational.core.mapping.JdbcPersistentProperty; +import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; /** * Unit tests for {@link CascadingDataAccessStrategy}. @@ -75,10 +75,10 @@ public class CascadingDataAccessStrategyUnitTests { @Test // DATAJDBC-123 public void findByPropertyReturnsFirstSuccess() { - doReturn(Collections.singletonList("success")).when(succeeds).findAllByProperty(eq(23L), any(JdbcPersistentProperty.class)); + doReturn(Collections.singletonList("success")).when(succeeds).findAllByProperty(eq(23L), any(RelationalPersistentProperty.class)); CascadingDataAccessStrategy access = new CascadingDataAccessStrategy(asList(alwaysFails, succeeds, mayNotCall)); - Iterable findAll = access.findAllByProperty(23L, mock(JdbcPersistentProperty.class)); + Iterable findAll = access.findAllByProperty(23L, mock(RelationalPersistentProperty.class)); assertThat(findAll).containsExactly("success"); } diff --git a/src/test/java/org/springframework/data/jdbc/core/DefaultDataAccessStrategyUnitTests.java b/src/test/java/org/springframework/data/jdbc/core/DefaultDataAccessStrategyUnitTests.java index 91fd56fd..dafeb0b0 100644 --- a/src/test/java/org/springframework/data/jdbc/core/DefaultDataAccessStrategyUnitTests.java +++ b/src/test/java/org/springframework/data/jdbc/core/DefaultDataAccessStrategyUnitTests.java @@ -28,7 +28,7 @@ import org.junit.Test; import org.mockito.ArgumentCaptor; import org.springframework.data.annotation.Id; import org.springframework.data.convert.EntityInstantiators; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; import org.springframework.jdbc.core.namedparam.SqlParameterSource; import org.springframework.jdbc.support.KeyHolder; @@ -44,7 +44,7 @@ public class DefaultDataAccessStrategyUnitTests { public static final long ORIGINAL_ID = 4711L; NamedParameterJdbcOperations jdbcOperations = mock(NamedParameterJdbcOperations.class); - JdbcMappingContext context = new JdbcMappingContext(); + RelationalMappingContext context = new RelationalMappingContext(); HashMap additionalParameters = new HashMap<>(); ArgumentCaptor paramSourceCaptor = ArgumentCaptor.forClass(SqlParameterSource.class); diff --git a/src/test/java/org/springframework/data/jdbc/core/DefaultJdbcInterpreterUnitTests.java b/src/test/java/org/springframework/data/jdbc/core/DefaultJdbcInterpreterUnitTests.java index 2c7c88c0..bce5a3de 100644 --- a/src/test/java/org/springframework/data/jdbc/core/DefaultJdbcInterpreterUnitTests.java +++ b/src/test/java/org/springframework/data/jdbc/core/DefaultJdbcInterpreterUnitTests.java @@ -26,10 +26,10 @@ import org.junit.Test; import org.mockito.ArgumentCaptor; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.conversion.DbAction; -import org.springframework.data.relational.core.conversion.JdbcPropertyPath; +import org.springframework.data.relational.core.conversion.RelationalPropertyPath; import org.springframework.data.relational.core.conversion.DbAction.Insert; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentProperty; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; import org.springframework.data.relational.core.mapping.NamingStrategy; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; @@ -43,9 +43,9 @@ public class DefaultJdbcInterpreterUnitTests { static final long CONTAINER_ID = 23L; static final String BACK_REFERENCE = "back-reference"; - JdbcMappingContext context = new JdbcMappingContext(new NamingStrategy() { + RelationalMappingContext context = new RelationalMappingContext(new NamingStrategy() { @Override - public String getReverseColumnName(JdbcPersistentProperty property) { + public String getReverseColumnName(RelationalPersistentProperty property) { return BACK_REFERENCE; } }); @@ -61,8 +61,8 @@ public class DefaultJdbcInterpreterUnitTests { Element element = new Element(); - Insert containerInsert = DbAction.insert(container, JdbcPropertyPath.from("", Container.class), null); - Insert insert = DbAction.insert(element, JdbcPropertyPath.from("element", Container.class), containerInsert); + Insert containerInsert = DbAction.insert(container, RelationalPropertyPath.from("", Container.class), null); + Insert insert = DbAction.insert(element, RelationalPropertyPath.from("element", Container.class), containerInsert); interpreter.interpret(insert); diff --git a/src/test/java/org/springframework/data/jdbc/core/EntityRowMapperUnitTests.java b/src/test/java/org/springframework/data/jdbc/core/EntityRowMapperUnitTests.java index 71d59ff7..c1b14e0e 100644 --- a/src/test/java/org/springframework/data/jdbc/core/EntityRowMapperUnitTests.java +++ b/src/test/java/org/springframework/data/jdbc/core/EntityRowMapperUnitTests.java @@ -43,9 +43,9 @@ import org.springframework.core.convert.support.GenericConversionService; import org.springframework.data.annotation.Id; import org.springframework.data.convert.EntityInstantiators; import org.springframework.data.convert.Jsr310Converters; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntity; -import org.springframework.data.relational.core.mapping.JdbcPersistentProperty; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; +import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; import org.springframework.data.relational.core.mapping.NamingStrategy; import org.springframework.util.Assert; @@ -61,7 +61,7 @@ public class EntityRowMapperUnitTests { public static final long ID_FOR_ENTITY_NOT_REFERENCING_MAP = 23L; public static final NamingStrategy X_APPENDING_NAMINGSTRATEGY = new NamingStrategy() { @Override - public String getColumnName(JdbcPersistentProperty property) { + public String getColumnName(RelationalPersistentProperty property) { return NamingStrategy.super.getColumnName(property) + "x"; } }; @@ -177,23 +177,23 @@ public class EntityRowMapperUnitTests { private EntityRowMapper createRowMapper(Class type, NamingStrategy namingStrategy) { - JdbcMappingContext context = new JdbcMappingContext(namingStrategy); + RelationalMappingContext context = new RelationalMappingContext(namingStrategy); DataAccessStrategy accessStrategy = mock(DataAccessStrategy.class); // the ID of the entity is used to determine what kind of ResultSet is needed for subsequent selects. doReturn(new HashSet<>(asList(new Trivial(), new Trivial()))).when(accessStrategy) - .findAllByProperty(eq(ID_FOR_ENTITY_NOT_REFERENCING_MAP), any(JdbcPersistentProperty.class)); + .findAllByProperty(eq(ID_FOR_ENTITY_NOT_REFERENCING_MAP), any(RelationalPersistentProperty.class)); doReturn(new HashSet<>(asList( // new SimpleEntry<>("one", new Trivial()), // new SimpleEntry<>("two", new Trivial()) // - ))).when(accessStrategy).findAllByProperty(eq(ID_FOR_ENTITY_REFERENCING_MAP), any(JdbcPersistentProperty.class)); + ))).when(accessStrategy).findAllByProperty(eq(ID_FOR_ENTITY_REFERENCING_MAP), any(RelationalPersistentProperty.class)); doReturn(new HashSet<>(asList( // new SimpleEntry<>(1, new Trivial()), // new SimpleEntry<>(2, new Trivial()) // - ))).when(accessStrategy).findAllByProperty(eq(ID_FOR_ENTITY_REFERENCING_LIST), any(JdbcPersistentProperty.class)); + ))).when(accessStrategy).findAllByProperty(eq(ID_FOR_ENTITY_REFERENCING_LIST), any(RelationalPersistentProperty.class)); GenericConversionService conversionService = new GenericConversionService(); conversionService.addConverter(new IterableOfEntryToMapConverter()); @@ -201,7 +201,7 @@ public class EntityRowMapperUnitTests { Jsr310Converters.getConvertersToRegister().forEach(conversionService::addConverter); return new EntityRowMapper<>( // - (JdbcPersistentEntity) context.getRequiredPersistentEntity(type), // + (RelationalPersistentEntity) context.getRequiredPersistentEntity(type), // context, // new EntityInstantiators(), // accessStrategy // diff --git a/src/test/java/org/springframework/data/jdbc/core/JdbcEntityTemplateIntegrationTests.java b/src/test/java/org/springframework/data/jdbc/core/JdbcEntityTemplateIntegrationTests.java index e2434b1f..8cc03a88 100644 --- a/src/test/java/org/springframework/data/jdbc/core/JdbcEntityTemplateIntegrationTests.java +++ b/src/test/java/org/springframework/data/jdbc/core/JdbcEntityTemplateIntegrationTests.java @@ -32,7 +32,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.data.annotation.Id; import org.springframework.data.jdbc.testing.TestConfiguration; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.rules.SpringClassRule; import org.springframework.test.context.junit4.rules.SpringMethodRule; @@ -251,7 +251,7 @@ public class JdbcEntityTemplateIntegrationTests { } @Bean - JdbcAggregateOperations operations(ApplicationEventPublisher publisher, JdbcMappingContext context, DataAccessStrategy dataAccessStrategy) { + JdbcAggregateOperations operations(ApplicationEventPublisher publisher, RelationalMappingContext context, DataAccessStrategy dataAccessStrategy) { return new JdbcAggregateTemplate(publisher, context, dataAccessStrategy); } } diff --git a/src/test/java/org/springframework/data/jdbc/core/MyBatisDataAccessStrategyUnitTests.java b/src/test/java/org/springframework/data/jdbc/core/MyBatisDataAccessStrategyUnitTests.java index 92f478c4..c2e51fba 100644 --- a/src/test/java/org/springframework/data/jdbc/core/MyBatisDataAccessStrategyUnitTests.java +++ b/src/test/java/org/springframework/data/jdbc/core/MyBatisDataAccessStrategyUnitTests.java @@ -30,7 +30,7 @@ import org.mockito.Mockito; import org.springframework.data.jdbc.mybatis.MyBatisContext; import org.springframework.data.jdbc.mybatis.MyBatisDataAccessStrategy; import org.springframework.data.mapping.PropertyPath; -import org.springframework.data.relational.core.mapping.JdbcPersistentProperty; +import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; /** * Unit tests for the {@link MyBatisDataAccessStrategy}, mainly ensuring that the correct statements get's looked up. @@ -250,7 +250,7 @@ public class MyBatisDataAccessStrategyUnitTests { @Test // DATAJDBC-123 public void findAllByProperty() { - JdbcPersistentProperty property = mock(JdbcPersistentProperty.class, Mockito.RETURNS_DEEP_STUBS); + RelationalPersistentProperty property = mock(RelationalPersistentProperty.class, Mockito.RETURNS_DEEP_STUBS); when(property.getOwner().getType()).thenReturn((Class) String.class); doReturn(Number.class).when(property).getType(); diff --git a/src/test/java/org/springframework/data/jdbc/core/SqlGeneratorContextBasedNamingStrategyUnitTests.java b/src/test/java/org/springframework/data/jdbc/core/SqlGeneratorContextBasedNamingStrategyUnitTests.java index 07742ab7..bf0834ce 100644 --- a/src/test/java/org/springframework/data/jdbc/core/SqlGeneratorContextBasedNamingStrategyUnitTests.java +++ b/src/test/java/org/springframework/data/jdbc/core/SqlGeneratorContextBasedNamingStrategyUnitTests.java @@ -26,8 +26,8 @@ import org.assertj.core.api.SoftAssertions; import org.junit.Test; import org.springframework.data.annotation.Id; import org.springframework.data.mapping.PropertyPath; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntity; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; import org.springframework.data.relational.core.mapping.NamingStrategy; /** @@ -200,8 +200,8 @@ public class SqlGeneratorContextBasedNamingStrategyUnitTests { */ private SqlGenerator configureSqlGenerator(NamingStrategy namingStrategy) { - JdbcMappingContext context = new JdbcMappingContext(namingStrategy); - JdbcPersistentEntity persistentEntity = context.getRequiredPersistentEntity(DummyEntity.class); + RelationalMappingContext context = new RelationalMappingContext(namingStrategy); + RelationalPersistentEntity persistentEntity = context.getRequiredPersistentEntity(DummyEntity.class); return new SqlGenerator(context, persistentEntity, new SqlGeneratorSource(context)); } diff --git a/src/test/java/org/springframework/data/jdbc/core/SqlGeneratorFixedNamingStrategyUnitTests.java b/src/test/java/org/springframework/data/jdbc/core/SqlGeneratorFixedNamingStrategyUnitTests.java index c08fd914..5c419403 100644 --- a/src/test/java/org/springframework/data/jdbc/core/SqlGeneratorFixedNamingStrategyUnitTests.java +++ b/src/test/java/org/springframework/data/jdbc/core/SqlGeneratorFixedNamingStrategyUnitTests.java @@ -21,9 +21,9 @@ import org.assertj.core.api.SoftAssertions; import org.junit.Test; import org.springframework.data.annotation.Id; import org.springframework.data.mapping.PropertyPath; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntity; -import org.springframework.data.relational.core.mapping.JdbcPersistentProperty; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; +import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; import org.springframework.data.relational.core.mapping.NamingStrategy; /** @@ -47,7 +47,7 @@ public class SqlGeneratorFixedNamingStrategyUnitTests { } @Override - public String getColumnName(JdbcPersistentProperty property) { + public String getColumnName(RelationalPersistentProperty property) { return "FixedCustomPropertyPrefix_" + property.getName(); } }; @@ -60,7 +60,7 @@ public class SqlGeneratorFixedNamingStrategyUnitTests { } @Override - public String getColumnName(JdbcPersistentProperty property) { + public String getColumnName(RelationalPersistentProperty property) { return property.getName().toLowerCase(); } }; @@ -179,8 +179,8 @@ public class SqlGeneratorFixedNamingStrategyUnitTests { */ private SqlGenerator configureSqlGenerator(NamingStrategy namingStrategy) { - JdbcMappingContext context = new JdbcMappingContext(namingStrategy); - JdbcPersistentEntity persistentEntity = context.getRequiredPersistentEntity(DummyEntity.class); + RelationalMappingContext context = new RelationalMappingContext(namingStrategy); + RelationalPersistentEntity persistentEntity = context.getRequiredPersistentEntity(DummyEntity.class); return new SqlGenerator(context, persistentEntity, new SqlGeneratorSource(context)); } diff --git a/src/test/java/org/springframework/data/jdbc/core/SqlGeneratorUnitTests.java b/src/test/java/org/springframework/data/jdbc/core/SqlGeneratorUnitTests.java index d71eb7fa..d605d64d 100644 --- a/src/test/java/org/springframework/data/jdbc/core/SqlGeneratorUnitTests.java +++ b/src/test/java/org/springframework/data/jdbc/core/SqlGeneratorUnitTests.java @@ -25,9 +25,9 @@ import org.junit.Before; import org.junit.Test; import org.springframework.data.annotation.Id; import org.springframework.data.mapping.PropertyPath; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntity; -import org.springframework.data.relational.core.mapping.JdbcPersistentProperty; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; +import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; import org.springframework.data.relational.core.mapping.NamingStrategy; /** @@ -44,8 +44,8 @@ public class SqlGeneratorUnitTests { public void setUp() { NamingStrategy namingStrategy = new PrefixingNamingStrategy(); - JdbcMappingContext context = new JdbcMappingContext(namingStrategy); - JdbcPersistentEntity persistentEntity = context.getRequiredPersistentEntity(DummyEntity.class); + RelationalMappingContext context = new RelationalMappingContext(namingStrategy); + RelationalPersistentEntity persistentEntity = context.getRequiredPersistentEntity(DummyEntity.class); this.sqlGenerator = new SqlGenerator(context, persistentEntity, new SqlGeneratorSource(context)); } @@ -184,7 +184,7 @@ public class SqlGeneratorUnitTests { private static class PrefixingNamingStrategy implements NamingStrategy { @Override - public String getColumnName(JdbcPersistentProperty property) { + public String getColumnName(RelationalPersistentProperty property) { return "x_" + NamingStrategy.super.getColumnName(property); } diff --git a/src/test/java/org/springframework/data/jdbc/mapping/model/JdbcMappingContextUnitTests.java b/src/test/java/org/springframework/data/jdbc/mapping/model/JdbcMappingContextUnitTests.java index 2f2c48e5..776149b4 100644 --- a/src/test/java/org/springframework/data/jdbc/mapping/model/JdbcMappingContextUnitTests.java +++ b/src/test/java/org/springframework/data/jdbc/mapping/model/JdbcMappingContextUnitTests.java @@ -23,14 +23,14 @@ import java.util.Set; import org.junit.Test; import org.springframework.data.mapping.PropertyPath; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; /** * @author Jens Schauder */ public class JdbcMappingContextUnitTests { - JdbcMappingContext context = new JdbcMappingContext(); + RelationalMappingContext context = new RelationalMappingContext(); // DATAJDBC-188 @Test diff --git a/src/test/java/org/springframework/data/jdbc/mapping/model/NamingStrategyUnitTests.java b/src/test/java/org/springframework/data/jdbc/mapping/model/NamingStrategyUnitTests.java index 0f17d0d2..9cee2c02 100644 --- a/src/test/java/org/springframework/data/jdbc/mapping/model/NamingStrategyUnitTests.java +++ b/src/test/java/org/springframework/data/jdbc/mapping/model/NamingStrategyUnitTests.java @@ -26,8 +26,8 @@ import java.util.List; import org.junit.Test; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.ConversionCustomizer; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntity; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; import org.springframework.data.relational.core.mapping.NamingStrategy; /** @@ -40,8 +40,8 @@ public class NamingStrategyUnitTests { private final NamingStrategy target = NamingStrategy.INSTANCE; - private final JdbcPersistentEntity persistentEntity = // - new JdbcMappingContext(target, mock(ConversionCustomizer.class)).getRequiredPersistentEntity(DummyEntity.class); + private final RelationalPersistentEntity persistentEntity = // + new RelationalMappingContext(target, mock(ConversionCustomizer.class)).getRequiredPersistentEntity(DummyEntity.class); @Test // DATAJDBC-184 public void getTableName() { diff --git a/src/test/java/org/springframework/data/jdbc/mybatis/MyBatisHsqlIntegrationTests.java b/src/test/java/org/springframework/data/jdbc/mybatis/MyBatisHsqlIntegrationTests.java index 4f22b998..0373911e 100644 --- a/src/test/java/org/springframework/data/jdbc/mybatis/MyBatisHsqlIntegrationTests.java +++ b/src/test/java/org/springframework/data/jdbc/mybatis/MyBatisHsqlIntegrationTests.java @@ -33,7 +33,7 @@ import org.springframework.context.annotation.Import; import org.springframework.data.jdbc.core.DataAccessStrategy; import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories; import org.springframework.data.jdbc.testing.TestConfiguration; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; import org.springframework.data.repository.CrudRepository; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; @@ -86,7 +86,7 @@ public class MyBatisHsqlIntegrationTests { } @Bean - DataAccessStrategy dataAccessStrategy(JdbcMappingContext context, SqlSession sqlSession, EmbeddedDatabase db) { + DataAccessStrategy dataAccessStrategy(RelationalMappingContext context, SqlSession sqlSession, EmbeddedDatabase db) { return MyBatisDataAccessStrategy.createCombinedAccessStrategy(context, new NamedParameterJdbcTemplate(db), sqlSession); } diff --git a/src/test/java/org/springframework/data/jdbc/repository/SimpleJdbcRepositoryEventsUnitTests.java b/src/test/java/org/springframework/data/jdbc/repository/SimpleJdbcRepositoryEventsUnitTests.java index 73a5e69b..4ef5e98a 100644 --- a/src/test/java/org/springframework/data/jdbc/repository/SimpleJdbcRepositoryEventsUnitTests.java +++ b/src/test/java/org/springframework/data/jdbc/repository/SimpleJdbcRepositoryEventsUnitTests.java @@ -41,14 +41,14 @@ import org.springframework.data.jdbc.core.DefaultDataAccessStrategy; import org.springframework.data.jdbc.core.SqlGeneratorSource; import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory; import org.springframework.data.jdbc.repository.support.SimpleJdbcRepository; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; import org.springframework.data.relational.core.mapping.event.AfterDeleteEvent; import org.springframework.data.relational.core.mapping.event.AfterLoadEvent; import org.springframework.data.relational.core.mapping.event.AfterSaveEvent; import org.springframework.data.relational.core.mapping.event.BeforeDeleteEvent; import org.springframework.data.relational.core.mapping.event.BeforeSaveEvent; import org.springframework.data.relational.core.mapping.event.Identifier; -import org.springframework.data.relational.core.mapping.event.JdbcEvent; +import org.springframework.data.relational.core.mapping.event.RelationalEvent; import org.springframework.data.repository.CrudRepository; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; import org.springframework.jdbc.core.namedparam.SqlParameterSource; @@ -71,7 +71,7 @@ public class SimpleJdbcRepositoryEventsUnitTests { @Before public void before() { - JdbcMappingContext context = new JdbcMappingContext(); + RelationalMappingContext context = new RelationalMappingContext(); NamedParameterJdbcOperations operations = createIdGeneratingOperations(); SqlGeneratorSource generatorSource = new SqlGeneratorSource(context); @@ -127,9 +127,9 @@ public class SimpleJdbcRepositoryEventsUnitTests { repository.delete(entity); assertThat(publisher.events).extracting( // - JdbcEvent::getClass, // + RelationalEvent::getClass, // e -> e.getOptionalEntity().orElseGet(AssertionFailedError::new), // - JdbcEvent::getId // + RelationalEvent::getId // ).containsExactly( // Tuple.tuple(BeforeDeleteEvent.class, entity, Identifier.of(23L)), // Tuple.tuple(AfterDeleteEvent.class, entity, Identifier.of(23L)) // @@ -233,11 +233,11 @@ public class SimpleJdbcRepositoryEventsUnitTests { static class CollectingEventPublisher implements ApplicationEventPublisher { - List events = new ArrayList<>(); + List events = new ArrayList<>(); @Override public void publishEvent(Object o) { - events.add((JdbcEvent) o); + events.add((RelationalEvent) o); } } } diff --git a/src/test/java/org/springframework/data/jdbc/repository/support/JdbcQueryLookupStrategyUnitTests.java b/src/test/java/org/springframework/data/jdbc/repository/support/JdbcQueryLookupStrategyUnitTests.java index aafc5f0d..06506016 100644 --- a/src/test/java/org/springframework/data/jdbc/repository/support/JdbcQueryLookupStrategyUnitTests.java +++ b/src/test/java/org/springframework/data/jdbc/repository/support/JdbcQueryLookupStrategyUnitTests.java @@ -31,7 +31,7 @@ import org.springframework.data.jdbc.repository.RowMapperMap; import org.springframework.data.jdbc.repository.config.ConfigurableRowMapperMap; import org.springframework.data.jdbc.repository.query.Query; import org.springframework.data.projection.ProjectionFactory; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; import org.springframework.data.repository.core.NamedQueries; import org.springframework.data.repository.core.RepositoryMetadata; import org.springframework.data.repository.query.RepositoryQuery; @@ -47,7 +47,7 @@ import org.springframework.jdbc.core.namedparam.SqlParameterSource; */ public class JdbcQueryLookupStrategyUnitTests { - JdbcMappingContext mappingContext = mock(JdbcMappingContext.class, RETURNS_DEEP_STUBS); + RelationalMappingContext mappingContext = mock(RelationalMappingContext.class, RETURNS_DEEP_STUBS); DataAccessStrategy accessStrategy = mock(DataAccessStrategy.class); ProjectionFactory projectionFactory = mock(ProjectionFactory.class); RepositoryMetadata metadata; diff --git a/src/test/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactoryBeanUnitTests.java b/src/test/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactoryBeanUnitTests.java index 05b7465d..a034bab4 100644 --- a/src/test/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactoryBeanUnitTests.java +++ b/src/test/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactoryBeanUnitTests.java @@ -29,7 +29,7 @@ import org.springframework.data.annotation.Id; import org.springframework.data.jdbc.core.DataAccessStrategy; import org.springframework.data.jdbc.core.DefaultDataAccessStrategy; import org.springframework.data.jdbc.repository.RowMapperMap; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; import org.springframework.data.repository.CrudRepository; import org.springframework.test.util.ReflectionTestUtils; @@ -49,12 +49,12 @@ public class JdbcRepositoryFactoryBeanUnitTests { @Mock DataAccessStrategy dataAccessStrategy; @Mock ApplicationEventPublisher publisher; - JdbcMappingContext mappingContext; + RelationalMappingContext mappingContext; @Before public void setUp() { - this.mappingContext = new JdbcMappingContext(); + this.mappingContext = new RelationalMappingContext(); // Setup standard configuration factoryBean = new JdbcRepositoryFactoryBean<>(DummyEntityRepository.class); diff --git a/src/test/java/org/springframework/data/jdbc/testing/TestConfiguration.java b/src/test/java/org/springframework/data/jdbc/testing/TestConfiguration.java index 7d9f474e..47d08c3c 100644 --- a/src/test/java/org/springframework/data/jdbc/testing/TestConfiguration.java +++ b/src/test/java/org/springframework/data/jdbc/testing/TestConfiguration.java @@ -31,7 +31,7 @@ import org.springframework.data.jdbc.core.DefaultDataAccessStrategy; import org.springframework.data.jdbc.core.SqlGeneratorSource; import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory; import org.springframework.data.relational.core.mapping.ConversionCustomizer; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; import org.springframework.data.relational.core.mapping.NamingStrategy; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; @@ -55,7 +55,7 @@ public class TestConfiguration { @Bean JdbcRepositoryFactory jdbcRepositoryFactory(DataAccessStrategy dataAccessStrategy) { - JdbcMappingContext context = new JdbcMappingContext(NamingStrategy.INSTANCE); + RelationalMappingContext context = new RelationalMappingContext(NamingStrategy.INSTANCE); return new JdbcRepositoryFactory(dataAccessStrategy, context, publisher, namedParameterJdbcTemplate()); } @@ -71,15 +71,15 @@ public class TestConfiguration { } @Bean - DataAccessStrategy defaultDataAccessStrategy(JdbcMappingContext context) { + DataAccessStrategy defaultDataAccessStrategy(RelationalMappingContext context) { return new DefaultDataAccessStrategy(new SqlGeneratorSource(context), context, namedParameterJdbcTemplate(), new EntityInstantiators()); } @Bean - JdbcMappingContext jdbcMappingContext(NamedParameterJdbcOperations template, Optional namingStrategy, + RelationalMappingContext jdbcMappingContext(NamedParameterJdbcOperations template, Optional namingStrategy, Optional conversionCustomizer) { - return new JdbcMappingContext(namingStrategy.orElse(NamingStrategy.INSTANCE), + return new RelationalMappingContext(namingStrategy.orElse(NamingStrategy.INSTANCE), conversionCustomizer.orElse(conversionService -> {})); } } diff --git a/src/test/java/org/springframework/data/relational/core/conversion/DbActionUnitTests.java b/src/test/java/org/springframework/data/relational/core/conversion/DbActionUnitTests.java index 0d74a186..3971a826 100644 --- a/src/test/java/org/springframework/data/relational/core/conversion/DbActionUnitTests.java +++ b/src/test/java/org/springframework/data/relational/core/conversion/DbActionUnitTests.java @@ -24,7 +24,7 @@ import org.junit.Test; import org.springframework.data.relational.core.conversion.DbAction; import org.springframework.data.relational.core.conversion.DbActionExecutionException; import org.springframework.data.relational.core.conversion.Interpreter; -import org.springframework.data.relational.core.conversion.JdbcPropertyPath; +import org.springframework.data.relational.core.conversion.RelationalPropertyPath; /** * Unit tests for {@link DbAction}s @@ -37,7 +37,7 @@ public class DbActionUnitTests { public void exceptionFromActionContainsUsefulInformationWhenInterpreterFails() { DummyEntity entity = new DummyEntity(); - DbAction.Insert insert = DbAction.insert(entity, JdbcPropertyPath.from("someName", DummyEntity.class), + DbAction.Insert insert = DbAction.insert(entity, RelationalPropertyPath.from("someName", DummyEntity.class), null); Interpreter failingInterpreter = mock(Interpreter.class); diff --git a/src/test/java/org/springframework/data/relational/core/conversion/JdbcEntityDeleteWriterUnitTests.java b/src/test/java/org/springframework/data/relational/core/conversion/RelationalEntityDeleteWriterUnitTests.java similarity index 79% rename from src/test/java/org/springframework/data/relational/core/conversion/JdbcEntityDeleteWriterUnitTests.java rename to src/test/java/org/springframework/data/relational/core/conversion/RelationalEntityDeleteWriterUnitTests.java index bc61afa7..4eff05e2 100644 --- a/src/test/java/org/springframework/data/relational/core/conversion/JdbcEntityDeleteWriterUnitTests.java +++ b/src/test/java/org/springframework/data/relational/core/conversion/RelationalEntityDeleteWriterUnitTests.java @@ -25,26 +25,26 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.conversion.AggregateChange; import org.springframework.data.relational.core.conversion.DbAction; -import org.springframework.data.relational.core.conversion.JdbcEntityDeleteWriter; -import org.springframework.data.relational.core.conversion.JdbcPropertyPath; +import org.springframework.data.relational.core.conversion.RelationalEntityDeleteWriter; +import org.springframework.data.relational.core.conversion.RelationalPropertyPath; import org.springframework.data.relational.core.conversion.AggregateChange.Kind; import org.springframework.data.relational.core.conversion.DbAction.Delete; import org.springframework.data.relational.core.conversion.DbAction.DeleteAll; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; /** - * Unit tests for the {@link JdbcEntityDeleteWriter} + * Unit tests for the {@link RelationalEntityDeleteWriter} * * @author Jens Schauder */ @RunWith(MockitoJUnitRunner.class) -public class JdbcEntityDeleteWriterUnitTests { +public class RelationalEntityDeleteWriterUnitTests { - JdbcEntityDeleteWriter converter = new JdbcEntityDeleteWriter(new JdbcMappingContext()); + RelationalEntityDeleteWriter converter = new RelationalEntityDeleteWriter(new RelationalMappingContext()); private static Object dotPath(DbAction dba) { - JdbcPropertyPath propertyPath = dba.getPropertyPath(); + RelationalPropertyPath propertyPath = dba.getPropertyPath(); return propertyPath == null ? null : propertyPath.toDotPath(); } @@ -58,7 +58,7 @@ public class JdbcEntityDeleteWriterUnitTests { converter.write(entity.id, aggregateChange); Assertions.assertThat(aggregateChange.getActions()) - .extracting(DbAction::getClass, DbAction::getEntityType, JdbcEntityDeleteWriterUnitTests::dotPath) // + .extracting(DbAction::getClass, DbAction::getEntityType, RelationalEntityDeleteWriterUnitTests::dotPath) // .containsExactly( // Tuple.tuple(Delete.class, YetAnother.class, "other.yetAnother"), // Tuple.tuple(Delete.class, OtherEntity.class, "other"), // @@ -76,7 +76,7 @@ public class JdbcEntityDeleteWriterUnitTests { converter.write(null, aggregateChange); Assertions.assertThat(aggregateChange.getActions()) - .extracting(DbAction::getClass, DbAction::getEntityType, JdbcEntityDeleteWriterUnitTests::dotPath) // + .extracting(DbAction::getClass, DbAction::getEntityType, RelationalEntityDeleteWriterUnitTests::dotPath) // .containsExactly( // Tuple.tuple(DeleteAll.class, YetAnother.class, "other.yetAnother"), // Tuple.tuple(DeleteAll.class, OtherEntity.class, "other"), // diff --git a/src/test/java/org/springframework/data/relational/core/conversion/JdbcEntityWriterUnitTests.java b/src/test/java/org/springframework/data/relational/core/conversion/RelationalEntityWriterUnitTests.java similarity index 97% rename from src/test/java/org/springframework/data/relational/core/conversion/JdbcEntityWriterUnitTests.java rename to src/test/java/org/springframework/data/relational/core/conversion/RelationalEntityWriterUnitTests.java index 3a426784..f3b74bd0 100644 --- a/src/test/java/org/springframework/data/relational/core/conversion/JdbcEntityWriterUnitTests.java +++ b/src/test/java/org/springframework/data/relational/core/conversion/RelationalEntityWriterUnitTests.java @@ -32,24 +32,24 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.conversion.AggregateChange; import org.springframework.data.relational.core.conversion.DbAction; -import org.springframework.data.relational.core.conversion.JdbcEntityWriter; +import org.springframework.data.relational.core.conversion.RelationalEntityWriter; import org.springframework.data.relational.core.conversion.AggregateChange.Kind; import org.springframework.data.relational.core.conversion.DbAction.Delete; import org.springframework.data.relational.core.conversion.DbAction.DeleteAll; import org.springframework.data.relational.core.conversion.DbAction.Insert; import org.springframework.data.relational.core.conversion.DbAction.Update; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; /** - * Unit tests for the {@link JdbcEntityWriter} + * Unit tests for the {@link RelationalEntityWriter} * * @author Jens Schauder */ @RunWith(MockitoJUnitRunner.class) -public class JdbcEntityWriterUnitTests { +public class RelationalEntityWriterUnitTests { public static final long SOME_ENTITY_ID = 23L; - JdbcEntityWriter converter = new JdbcEntityWriter(new JdbcMappingContext()); + RelationalEntityWriter converter = new RelationalEntityWriter(new RelationalMappingContext()); @Test // DATAJDBC-112 public void newEntityGetsConvertedToOneInsert() { diff --git a/src/test/java/org/springframework/data/relational/core/mapping/BasicJdbcPersistentPropertyUnitTests.java b/src/test/java/org/springframework/data/relational/core/mapping/BasicRelationalPersistentPropertyUnitTests.java similarity index 72% rename from src/test/java/org/springframework/data/relational/core/mapping/BasicJdbcPersistentPropertyUnitTests.java rename to src/test/java/org/springframework/data/relational/core/mapping/BasicRelationalPersistentPropertyUnitTests.java index e3cf2d37..794f4856 100644 --- a/src/test/java/org/springframework/data/relational/core/mapping/BasicJdbcPersistentPropertyUnitTests.java +++ b/src/test/java/org/springframework/data/relational/core/mapping/BasicRelationalPersistentPropertyUnitTests.java @@ -25,28 +25,28 @@ import java.util.Date; import org.junit.Test; import org.springframework.data.mapping.PropertyHandler; -import org.springframework.data.relational.core.mapping.BasicJdbcPersistentProperty; +import org.springframework.data.relational.core.mapping.BasicRelationalPersistentProperty; import org.springframework.data.relational.core.mapping.Column; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntity; -import org.springframework.data.relational.core.mapping.JdbcPersistentProperty; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; +import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; /** - * Unit tests for the {@link BasicJdbcPersistentProperty}. + * Unit tests for the {@link BasicRelationalPersistentProperty}. * * @author Jens Schauder * @author Oliver Gierke */ -public class BasicJdbcPersistentPropertyUnitTests { +public class BasicRelationalPersistentPropertyUnitTests { - JdbcMappingContext context = new JdbcMappingContext(); + RelationalMappingContext context = new RelationalMappingContext(); @Test // DATAJDBC-104 public void enumGetsStoredAsString() { - JdbcPersistentEntity persistentEntity = context.getRequiredPersistentEntity(DummyEntity.class); + RelationalPersistentEntity persistentEntity = context.getRequiredPersistentEntity(DummyEntity.class); - persistentEntity.doWithProperties((PropertyHandler) p -> { + persistentEntity.doWithProperties((PropertyHandler) p -> { switch (p.getName()) { case "someEnum": assertThat(p.getColumnType()).isEqualTo(String.class); @@ -65,7 +65,7 @@ public class BasicJdbcPersistentPropertyUnitTests { @Test // DATAJDBC-106 public void detectsAnnotatedColumnName() { - JdbcPersistentEntity entity = context.getRequiredPersistentEntity(DummyEntity.class); + RelationalPersistentEntity entity = context.getRequiredPersistentEntity(DummyEntity.class); assertThat(entity.getRequiredPersistentProperty("name").getColumnName()).isEqualTo("dummy_name"); assertThat(entity.getRequiredPersistentProperty("localDateTime").getColumnName()) diff --git a/src/test/java/org/springframework/data/relational/core/mapping/NamingStrategyUnitTests.java b/src/test/java/org/springframework/data/relational/core/mapping/NamingStrategyUnitTests.java index 8936be34..6c7c98be 100644 --- a/src/test/java/org/springframework/data/relational/core/mapping/NamingStrategyUnitTests.java +++ b/src/test/java/org/springframework/data/relational/core/mapping/NamingStrategyUnitTests.java @@ -22,10 +22,10 @@ import java.util.List; import org.junit.Test; import org.springframework.data.annotation.Id; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntity; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; import org.springframework.data.relational.core.mapping.NamingStrategy; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntityImplUnitTests.DummySubEntity; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntityImplUnitTests.DummySubEntity; /** * Unit tests for the {@link NamingStrategy}. @@ -37,8 +37,8 @@ import org.springframework.data.relational.core.mapping.JdbcPersistentEntityImpl public class NamingStrategyUnitTests { private final NamingStrategy target = NamingStrategy.INSTANCE; - private final JdbcMappingContext context = new JdbcMappingContext(target); - private final JdbcPersistentEntity persistentEntity = context.getRequiredPersistentEntity(DummyEntity.class); + private final RelationalMappingContext context = new RelationalMappingContext(target); + private final RelationalPersistentEntity persistentEntity = context.getRequiredPersistentEntity(DummyEntity.class); @Test public void getTableName() { diff --git a/src/test/java/org/springframework/data/relational/core/mapping/JdbcMappingContextUnitTests.java b/src/test/java/org/springframework/data/relational/core/mapping/RelationalMappingContextUnitTests.java similarity index 83% rename from src/test/java/org/springframework/data/relational/core/mapping/JdbcMappingContextUnitTests.java rename to src/test/java/org/springframework/data/relational/core/mapping/RelationalMappingContextUnitTests.java index 06ccbc3c..34f1ec00 100644 --- a/src/test/java/org/springframework/data/relational/core/mapping/JdbcMappingContextUnitTests.java +++ b/src/test/java/org/springframework/data/relational/core/mapping/RelationalMappingContextUnitTests.java @@ -21,20 +21,20 @@ import java.util.List; import org.junit.Test; import org.springframework.data.mapping.PropertyPath; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; /** - * Unit tests for {@link JdbcMappingContext}. + * Unit tests for {@link RelationalMappingContext}. * * @author Jens Schauder * @author Oliver Gierke */ -public class JdbcMappingContextUnitTests { +public class RelationalMappingContextUnitTests { @Test // DATAJDBC-142 public void referencedEntitiesGetFound() { - JdbcMappingContext mappingContext = new JdbcMappingContext(); + RelationalMappingContext mappingContext = new RelationalMappingContext(); List propertyPaths = mappingContext.referencedEntities(DummyEntity.class, null); @@ -46,7 +46,7 @@ public class JdbcMappingContextUnitTests { @Test // DATAJDBC-142 public void propertyPathDoesNotDependOnNamingStrategy() { - JdbcMappingContext mappingContext = new JdbcMappingContext(); + RelationalMappingContext mappingContext = new RelationalMappingContext(); List propertyPaths = mappingContext.referencedEntities(DummyEntity.class, null); diff --git a/src/test/java/org/springframework/data/relational/core/mapping/JdbcPersistentEntityImplUnitTests.java b/src/test/java/org/springframework/data/relational/core/mapping/RelationalPersistentEntityImplUnitTests.java similarity index 66% rename from src/test/java/org/springframework/data/relational/core/mapping/JdbcPersistentEntityImplUnitTests.java rename to src/test/java/org/springframework/data/relational/core/mapping/RelationalPersistentEntityImplUnitTests.java index 1ef5b9c8..eaebe4cc 100644 --- a/src/test/java/org/springframework/data/relational/core/mapping/JdbcPersistentEntityImplUnitTests.java +++ b/src/test/java/org/springframework/data/relational/core/mapping/RelationalPersistentEntityImplUnitTests.java @@ -18,25 +18,25 @@ package org.springframework.data.relational.core.mapping; import static org.assertj.core.api.Assertions.*; import org.junit.Test; -import org.springframework.data.relational.core.mapping.JdbcMappingContext; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntity; -import org.springframework.data.relational.core.mapping.JdbcPersistentEntityImpl; +import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; +import org.springframework.data.relational.core.mapping.RelationalPersistentEntityImpl; import org.springframework.data.relational.core.mapping.Table; /** - * Unit tests for {@link JdbcPersistentEntityImpl}. + * Unit tests for {@link RelationalPersistentEntityImpl}. * * @author Oliver Gierke * @author Kazuki Shimizu */ -public class JdbcPersistentEntityImplUnitTests { +public class RelationalPersistentEntityImplUnitTests { - JdbcMappingContext mappingContext = new JdbcMappingContext(); + RelationalMappingContext mappingContext = new RelationalMappingContext(); @Test // DATAJDBC-106 public void discoversAnnotatedTableName() { - JdbcPersistentEntity entity = mappingContext.getPersistentEntity(DummySubEntity.class); + RelationalPersistentEntity entity = mappingContext.getPersistentEntity(DummySubEntity.class); assertThat(entity.getTableName()).isEqualTo("dummy_sub_entity"); }