#379 - Reflect package changes in Spring Data JDBC.

This commit is contained in:
Oliver Gierke
2018-06-28 11:47:32 +02:00
parent 8b00fa0500
commit b0bfdaeaee
5 changed files with 17 additions and 16 deletions

View File

@@ -25,11 +25,11 @@ import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.jdbc.core.mapping.event.BeforeSaveEvent;
import org.springframework.data.jdbc.core.mapping.ConversionCustomizer;
import org.springframework.data.jdbc.core.mapping.JdbcPersistentProperty;
import org.springframework.data.jdbc.core.mapping.NamingStrategy;
import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories;
import org.springframework.data.relational.core.mapping.ConversionCustomizer;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.relational.core.mapping.NamingStrategy;
import org.springframework.data.relational.core.mapping.event.BeforeSaveEvent;
import org.springframework.lang.Nullable;
/**
@@ -81,7 +81,7 @@ public class AggregateConfiguration {
return new NamingStrategy() {
@Override
public String getColumnName(JdbcPersistentProperty property) {
public String getColumnName(RelationalPersistentProperty property) {
String defaultName = NamingStrategy.super.getColumnName(property);
String key = getTableName(property.getOwner().getType()) + "." + defaultName;
@@ -89,13 +89,13 @@ public class AggregateConfiguration {
}
@Override
public String getReverseColumnName(JdbcPersistentProperty property) {
public String getReverseColumnName(RelationalPersistentProperty property) {
return reverseColumnAliases.computeIfAbsent(property.getName(),
__ -> NamingStrategy.super.getReverseColumnName(property));
}
@Override
public String getKeyColumn(JdbcPersistentProperty property) {
public String getKeyColumn(RelationalPersistentProperty property) {
return keyColumnAliases.computeIfAbsent(property.getName(), __ -> NamingStrategy.super.getKeyColumn(property));
}
};

View File

@@ -18,8 +18,8 @@ package example.springdata.jdbc.basics.aggregate;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.Column;
import org.springframework.data.jdbc.core.mapping.Table;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;
/**
* A manual instructing how to assemble a {@link LegoSet}.

View File

@@ -19,9 +19,9 @@ import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jdbc.core.mapping.event.BeforeSaveEvent;
import org.springframework.data.jdbc.core.mapping.event.JdbcEvent;
import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories;
import org.springframework.data.relational.core.mapping.event.BeforeSaveEvent;
import org.springframework.data.relational.core.mapping.event.RelationalEvent;
/**
* Contains infrastructure necessary for creating repositories and two listeners.
@@ -38,7 +38,7 @@ public class CategoryConfiguration {
public ApplicationListener<?> loggingListener() {
return (ApplicationListener<ApplicationEvent>) event -> {
if (event instanceof JdbcEvent) {
if (event instanceof RelationalEvent) {
System.out.println("Received an event: " + event);
}
};

View File

@@ -19,9 +19,9 @@ import org.apache.ibatis.session.SqlSession;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jdbc.core.DataAccessStrategy;
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
import org.springframework.data.jdbc.mybatis.MyBatisDataAccessStrategy;
import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
/**
@@ -32,7 +32,8 @@ import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
public class MyBatisConfiguration {
@Bean
DataAccessStrategy defaultDataAccessStrategy(JdbcMappingContext context, NamedParameterJdbcOperations operations, SqlSession sqlSession) {
DataAccessStrategy defaultDataAccessStrategy(RelationalMappingContext context,
NamedParameterJdbcOperations operations, SqlSession sqlSession) {
return MyBatisDataAccessStrategy.createCombinedAccessStrategy(context, operations, sqlSession);
}
}

View File

@@ -21,9 +21,9 @@ import io.r2dbc.spi.ConnectionFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
import org.springframework.data.r2dbc.function.DatabaseClient;
import org.springframework.data.r2dbc.repository.support.R2dbcRepositoryFactory;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
/**
* @author Oliver Gierke
@@ -39,7 +39,7 @@ class InfrastructureConfiguration {
@Bean
R2dbcRepositoryFactory repositoryFactory(DatabaseClient client) {
JdbcMappingContext context = new JdbcMappingContext();
RelationalMappingContext context = new RelationalMappingContext();
context.afterPropertiesSet();
return new R2dbcRepositoryFactory(client, context);