#379 - Reflect package changes in Spring Data JDBC.
This commit is contained in:
@@ -25,11 +25,11 @@ import org.springframework.context.ApplicationListener;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.core.convert.converter.Converter;
|
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.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;
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,7 +81,7 @@ public class AggregateConfiguration {
|
|||||||
return new NamingStrategy() {
|
return new NamingStrategy() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getColumnName(JdbcPersistentProperty property) {
|
public String getColumnName(RelationalPersistentProperty property) {
|
||||||
|
|
||||||
String defaultName = NamingStrategy.super.getColumnName(property);
|
String defaultName = NamingStrategy.super.getColumnName(property);
|
||||||
String key = getTableName(property.getOwner().getType()) + "." + defaultName;
|
String key = getTableName(property.getOwner().getType()) + "." + defaultName;
|
||||||
@@ -89,13 +89,13 @@ public class AggregateConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getReverseColumnName(JdbcPersistentProperty property) {
|
public String getReverseColumnName(RelationalPersistentProperty property) {
|
||||||
return reverseColumnAliases.computeIfAbsent(property.getName(),
|
return reverseColumnAliases.computeIfAbsent(property.getName(),
|
||||||
__ -> NamingStrategy.super.getReverseColumnName(property));
|
__ -> NamingStrategy.super.getReverseColumnName(property));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getKeyColumn(JdbcPersistentProperty property) {
|
public String getKeyColumn(RelationalPersistentProperty property) {
|
||||||
return keyColumnAliases.computeIfAbsent(property.getName(), __ -> NamingStrategy.super.getKeyColumn(property));
|
return keyColumnAliases.computeIfAbsent(property.getName(), __ -> NamingStrategy.super.getKeyColumn(property));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ package example.springdata.jdbc.basics.aggregate;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.jdbc.core.mapping.Column;
|
import org.springframework.data.relational.core.mapping.Column;
|
||||||
import org.springframework.data.jdbc.core.mapping.Table;
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A manual instructing how to assemble a {@link LegoSet}.
|
* A manual instructing how to assemble a {@link LegoSet}.
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ import org.springframework.context.ApplicationEvent;
|
|||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
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.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.
|
* Contains infrastructure necessary for creating repositories and two listeners.
|
||||||
@@ -38,7 +38,7 @@ public class CategoryConfiguration {
|
|||||||
public ApplicationListener<?> loggingListener() {
|
public ApplicationListener<?> loggingListener() {
|
||||||
|
|
||||||
return (ApplicationListener<ApplicationEvent>) event -> {
|
return (ApplicationListener<ApplicationEvent>) event -> {
|
||||||
if (event instanceof JdbcEvent) {
|
if (event instanceof RelationalEvent) {
|
||||||
System.out.println("Received an event: " + event);
|
System.out.println("Received an event: " + event);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ import org.apache.ibatis.session.SqlSession;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.jdbc.core.DataAccessStrategy;
|
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.mybatis.MyBatisDataAccessStrategy;
|
||||||
import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories;
|
import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories;
|
||||||
|
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
|
||||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
|
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,7 +32,8 @@ import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
|
|||||||
public class MyBatisConfiguration {
|
public class MyBatisConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
DataAccessStrategy defaultDataAccessStrategy(JdbcMappingContext context, NamedParameterJdbcOperations operations, SqlSession sqlSession) {
|
DataAccessStrategy defaultDataAccessStrategy(RelationalMappingContext context,
|
||||||
|
NamedParameterJdbcOperations operations, SqlSession sqlSession) {
|
||||||
return MyBatisDataAccessStrategy.createCombinedAccessStrategy(context, operations, sqlSession);
|
return MyBatisDataAccessStrategy.createCombinedAccessStrategy(context, operations, sqlSession);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ import io.r2dbc.spi.ConnectionFactory;
|
|||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
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.function.DatabaseClient;
|
||||||
import org.springframework.data.r2dbc.repository.support.R2dbcRepositoryFactory;
|
import org.springframework.data.r2dbc.repository.support.R2dbcRepositoryFactory;
|
||||||
|
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
@@ -39,7 +39,7 @@ class InfrastructureConfiguration {
|
|||||||
@Bean
|
@Bean
|
||||||
R2dbcRepositoryFactory repositoryFactory(DatabaseClient client) {
|
R2dbcRepositoryFactory repositoryFactory(DatabaseClient client) {
|
||||||
|
|
||||||
JdbcMappingContext context = new JdbcMappingContext();
|
RelationalMappingContext context = new RelationalMappingContext();
|
||||||
context.afterPropertiesSet();
|
context.afterPropertiesSet();
|
||||||
|
|
||||||
return new R2dbcRepositoryFactory(client, context);
|
return new R2dbcRepositoryFactory(client, context);
|
||||||
|
|||||||
Reference in New Issue
Block a user