diff --git a/guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/Board.java b/guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/Board.java index 13b3e17d..b65be09c 100644 --- a/guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/Board.java +++ b/guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/Board.java @@ -37,7 +37,7 @@ import lombok.Value; import lombok.With; -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SqlTableAlias; +import com.navercorp.spring.jdbc.plus.commons.annotations.SqlTableAlias; /** * @author Myeonghyeon Lee diff --git a/guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/PostDto.java b/guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/PostDto.java index 0a07de91..6b425677 100644 --- a/guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/PostDto.java +++ b/guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/PostDto.java @@ -28,9 +28,9 @@ import lombok.Builder; import lombok.Value; -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SqlTableAlias; import com.navercorp.spring.data.jdbc.plus.sql.guide.board.Board.Label; import com.navercorp.spring.data.jdbc.plus.sql.guide.board.Board.Post; +import com.navercorp.spring.jdbc.plus.commons.annotations.SqlTableAlias; /** * @author Myeonghyeon Lee diff --git a/guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/order/Order.java b/guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/order/Order.java index e895549f..89a7b7c0 100644 --- a/guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/order/Order.java +++ b/guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/order/Order.java @@ -27,7 +27,7 @@ import lombok.Builder; import lombok.Getter; -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SqlFunction; +import com.navercorp.spring.jdbc.plus.commons.annotations.SqlFunction; /** * @author Myeonghyeon Lee diff --git a/guide-projects/plus-sql-java-kotlin-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/Board.java b/guide-projects/plus-sql-java-kotlin-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/Board.java index 394de62c..097d2000 100644 --- a/guide-projects/plus-sql-java-kotlin-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/Board.java +++ b/guide-projects/plus-sql-java-kotlin-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/Board.java @@ -36,7 +36,7 @@ import lombok.Value; import lombok.With; -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SqlTableAlias; +import com.navercorp.spring.jdbc.plus.commons.annotations.SqlTableAlias; /** * @author Myeonghyeon Lee diff --git a/guide-projects/plus-sql-java-kotlin-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/PostDto.java b/guide-projects/plus-sql-java-kotlin-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/PostDto.java index 757504ae..41cda0c2 100644 --- a/guide-projects/plus-sql-java-kotlin-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/PostDto.java +++ b/guide-projects/plus-sql-java-kotlin-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/PostDto.java @@ -28,7 +28,7 @@ import lombok.Builder; import lombok.Value; -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SqlTableAlias; +import com.navercorp.spring.jdbc.plus.commons.annotations.SqlTableAlias; /** * @author Myeonghyeon Lee diff --git a/guide-projects/plus-sql-java-kotlin-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/order/Order.java b/guide-projects/plus-sql-java-kotlin-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/order/Order.java index 87e941ed..64f7a6fb 100644 --- a/guide-projects/plus-sql-java-kotlin-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/order/Order.java +++ b/guide-projects/plus-sql-java-kotlin-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/order/Order.java @@ -24,7 +24,7 @@ import lombok.Builder; import lombok.Getter; -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SqlFunction; +import com.navercorp.spring.jdbc.plus.commons.annotations.SqlFunction; /** * @author Myeonghyeon Lee diff --git a/guide-projects/plus-sql-kotlin-guide/src/main/kotlin/com/navercorp/spring/data/jdbc/plus/sql/guide/board/Board.kt b/guide-projects/plus-sql-kotlin-guide/src/main/kotlin/com/navercorp/spring/data/jdbc/plus/sql/guide/board/Board.kt index a2d04153..7967c2bb 100644 --- a/guide-projects/plus-sql-kotlin-guide/src/main/kotlin/com/navercorp/spring/data/jdbc/plus/sql/guide/board/Board.kt +++ b/guide-projects/plus-sql-kotlin-guide/src/main/kotlin/com/navercorp/spring/data/jdbc/plus/sql/guide/board/Board.kt @@ -18,7 +18,7 @@ package com.navercorp.spring.data.jdbc.plus.sql.guide.board -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SqlTableAlias +import com.navercorp.spring.jdbc.plus.commons.annotations.SqlTableAlias import org.springframework.data.annotation.Id import org.springframework.data.relational.core.mapping.Column import org.springframework.data.relational.core.mapping.Embedded diff --git a/guide-projects/plus-sql-kotlin-guide/src/main/kotlin/com/navercorp/spring/data/jdbc/plus/sql/guide/board/PostDto.kt b/guide-projects/plus-sql-kotlin-guide/src/main/kotlin/com/navercorp/spring/data/jdbc/plus/sql/guide/board/PostDto.kt index cb246a07..a75b4bf7 100644 --- a/guide-projects/plus-sql-kotlin-guide/src/main/kotlin/com/navercorp/spring/data/jdbc/plus/sql/guide/board/PostDto.kt +++ b/guide-projects/plus-sql-kotlin-guide/src/main/kotlin/com/navercorp/spring/data/jdbc/plus/sql/guide/board/PostDto.kt @@ -18,7 +18,7 @@ package com.navercorp.spring.data.jdbc.plus.sql.guide.board -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SqlTableAlias +import com.navercorp.spring.jdbc.plus.commons.annotations.SqlTableAlias import org.springframework.data.annotation.Id import org.springframework.data.relational.core.mapping.Column import org.springframework.data.relational.core.mapping.MappedCollection diff --git a/settings.gradle b/settings.gradle index 1b43e4cc..fe663b3b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,8 @@ rootProject.name = "spring-jdbc-plus" +include "spring-jdbc-plus-commons" include "spring-jdbc-plus-support" +include "spring-data-jdbc-plus-support" include "spring-data-jdbc-plus-sql" include "spring-data-jdbc-plus-repository" include "spring-boot-autoconfigure-data-jdbc-plus" diff --git a/spring-boot-autoconfigure-data-jdbc-plus/src/main/java/com/navercorp/spring/boot/autoconfigure/data/jdbc/plus/sql/JdbcPlusSqlAutoConfiguration.java b/spring-boot-autoconfigure-data-jdbc-plus/src/main/java/com/navercorp/spring/boot/autoconfigure/data/jdbc/plus/sql/JdbcPlusSqlAutoConfiguration.java index 28f23d6c..159cc574 100644 --- a/spring-boot-autoconfigure-data-jdbc-plus/src/main/java/com/navercorp/spring/boot/autoconfigure/data/jdbc/plus/sql/JdbcPlusSqlAutoConfiguration.java +++ b/spring-boot-autoconfigure-data-jdbc-plus/src/main/java/com/navercorp/spring/boot/autoconfigure/data/jdbc/plus/sql/JdbcPlusSqlAutoConfiguration.java @@ -42,7 +42,7 @@ import reactor.core.publisher.Flux; import com.navercorp.spring.data.jdbc.plus.sql.config.JdbcPlusSqlConfiguration; -import com.navercorp.spring.data.jdbc.plus.sql.convert.SqlProvider; +import com.navercorp.spring.data.jdbc.plus.support.convert.SqlProvider; import com.navercorp.spring.data.jdbc.plus.sql.parametersource.SqlParameterSourceFactory; import com.navercorp.spring.data.jdbc.plus.sql.provider.EntityJdbcProvider; import com.navercorp.spring.data.jdbc.plus.sql.support.template.JdbcReactiveTemplate; diff --git a/spring-data-jdbc-plus-sql/build.gradle b/spring-data-jdbc-plus-sql/build.gradle index f2a480bb..9578334a 100644 --- a/spring-data-jdbc-plus-sql/build.gradle +++ b/spring-data-jdbc-plus-sql/build.gradle @@ -1,10 +1,9 @@ compileJava.dependsOn(processResources) dependencies { + api(project(":spring-jdbc-plus-commons")) api(project(":spring-jdbc-plus-support")) - api("org.springframework.data:spring-data-jdbc") - api("org.springframework.data:spring-data-relational") - api("org.springframework.data:spring-data-commons") + api(project(":spring-data-jdbc-plus-support")) compileOnly("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}") compileOnly("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}") diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/config/JdbcPlusSqlConfiguration.java b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/config/JdbcPlusSqlConfiguration.java index ec30397c..4e6c43ab 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/config/JdbcPlusSqlConfiguration.java +++ b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/config/JdbcPlusSqlConfiguration.java @@ -33,7 +33,7 @@ import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; import com.navercorp.spring.data.jdbc.plus.sql.convert.AggregateResultJdbcConverter; -import com.navercorp.spring.data.jdbc.plus.sql.convert.SqlProvider; +import com.navercorp.spring.data.jdbc.plus.support.convert.SqlProvider; import com.navercorp.spring.data.jdbc.plus.sql.parametersource.DefaultSqlParameterSourceFactory; import com.navercorp.spring.data.jdbc.plus.sql.parametersource.SqlParameterSourceFactory; import com.navercorp.spring.data.jdbc.plus.sql.provider.EntityJdbcProvider; diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/AggregateResultJdbcConverter.java b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/AggregateResultJdbcConverter.java index 88c48ff3..ccefdc31 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/AggregateResultJdbcConverter.java +++ b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/AggregateResultJdbcConverter.java @@ -60,6 +60,8 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; +import com.navercorp.spring.data.jdbc.plus.support.convert.PropertyPathUtils; + /** * The type Aggregate result jdbc converter. * diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/JdbcBackReferencePropertyValueProvider.java b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/JdbcBackReferencePropertyValueProvider.java index 6eae1516..0cccd867 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/JdbcBackReferencePropertyValueProvider.java +++ b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/JdbcBackReferencePropertyValueProvider.java @@ -20,6 +20,8 @@ import org.springframework.data.relational.core.mapping.AggregatePath; import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; +import com.navercorp.spring.data.jdbc.plus.support.convert.PropertyPathUtils; + /** * {@link PropertyValueProvider} obtaining values from a ResultSetAccessor. For a given id property it provides * the value in the resultset under which other entities refer back to it. diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/JdbcPropertyValueProvider.java b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/JdbcPropertyValueProvider.java index 8bc83a80..561a2777 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/JdbcPropertyValueProvider.java +++ b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/JdbcPropertyValueProvider.java @@ -20,6 +20,8 @@ import org.springframework.data.relational.core.mapping.AggregatePath; import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; +import com.navercorp.spring.data.jdbc.plus.support.convert.PropertyPathUtils; + /** * {@link PropertyValueProvider} obtaining values from a ResultSetAccessor. * diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/ConvertibleSqlIdentifierParameterSource.java b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/ConvertibleSqlIdentifierParameterSource.java index 2da2af2a..e3a9647b 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/ConvertibleSqlIdentifierParameterSource.java +++ b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/ConvertibleSqlIdentifierParameterSource.java @@ -19,7 +19,11 @@ package com.navercorp.spring.data.jdbc.plus.sql.parametersource; import java.util.Objects; +import java.util.Set; +import org.springframework.data.relational.core.sql.SqlIdentifier; + +import com.navercorp.spring.data.jdbc.plus.support.parametersource.MutableSqlIdentifierParameterSource; import com.navercorp.spring.jdbc.plus.support.parametersource.converter.IterableExpandPadding; import com.navercorp.spring.jdbc.plus.support.parametersource.converter.JdbcParameterSourceConverter; import com.navercorp.spring.jdbc.plus.support.parametersource.fallback.FallbackParameterSource; @@ -29,7 +33,8 @@ * * @author Myeonghyeon Lee */ -class ConvertibleSqlIdentifierParameterSource extends SqlIdentifierParameterSource { +class ConvertibleSqlIdentifierParameterSource implements MutableSqlIdentifierParameterSource { + private final MutableSqlIdentifierParameterSource delegate; private final JdbcParameterSourceConverter converter; private final FallbackParameterSource fallbackParameterSource; @@ -47,7 +52,7 @@ class ConvertibleSqlIdentifierParameterSource extends SqlIdentifierParameterSour JdbcParameterSourceConverter converter, FallbackParameterSource fallbackParameterSource ) { - super(); + this.delegate = MutableSqlIdentifierParameterSource.create(); this.converter = Objects.requireNonNull(converter, "Converter must not be null."); this.fallbackParameterSource = fallbackParameterSource; } @@ -56,7 +61,7 @@ class ConvertibleSqlIdentifierParameterSource extends SqlIdentifierParameterSour public Object getValue(String paramName) throws IllegalArgumentException { Object value = null; try { - value = super.getValue(paramName); + value = delegate.getValue(paramName); } catch (IllegalArgumentException e) { if (!this.isFallback(paramName)) { throw e; @@ -79,6 +84,46 @@ public Object getValue(String paramName) throws IllegalArgumentException { return value; } + @Override + public Set getIdentifiers() { + return delegate.getIdentifiers(); + } + + @Override + public void addValue(SqlIdentifier name, Object value) { + delegate.addValue(name, value); + } + + @Override + public void addValue(SqlIdentifier identifier, Object value, int sqlType) { + delegate.addValue(identifier, value, sqlType); + } + + @Override + public void addAll(MutableSqlIdentifierParameterSource others) { + delegate.addAll(others); + } + + @Override + public boolean hasValue(String paramName) { + return delegate.hasValue(paramName); + } + + @Override + public int getSqlType(String paramName) { + return delegate.getSqlType(paramName); + } + + @Override + public String getTypeName(String paramName) { + return delegate.getTypeName(paramName); + } + + @Override + public String[] getParameterNames() { + return delegate.getParameterNames(); + } + /** * Sets padding iterable boundaries. * diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/DefaultSqlParameterSourceFactory.java b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/DefaultSqlParameterSourceFactory.java index 05dc22f1..14f90c1f 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/DefaultSqlParameterSourceFactory.java +++ b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/DefaultSqlParameterSourceFactory.java @@ -27,6 +27,8 @@ import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.namedparam.SqlParameterSource; +import com.navercorp.spring.data.jdbc.plus.support.parametersource.MutableSqlIdentifierParameterSource; + /** * The type Default sql parameter source factory. * @@ -62,7 +64,7 @@ public MapSqlParameterSource mapParameterSource(Map map) { @Override public SqlParameterSource entityParameterSource(Object entity) { - SqlIdentifierParameterSource parameterSource = new SqlIdentifierParameterSource(); + MutableSqlIdentifierParameterSource parameterSource = MutableSqlIdentifierParameterSource.create(); RelationalPersistentEntity persistentEntity = this.mappingContext.getRequiredPersistentEntity(entity.getClass()); this.parameterSourceApplier.addParameterSource(parameterSource, entity, persistentEntity, ""); diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/EntityConvertibleSqlParameterSourceFactory.java b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/EntityConvertibleSqlParameterSourceFactory.java index fb2c3961..90bc8568 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/EntityConvertibleSqlParameterSourceFactory.java +++ b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/EntityConvertibleSqlParameterSourceFactory.java @@ -27,6 +27,7 @@ import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.namedparam.SqlParameterSource; +import com.navercorp.spring.data.jdbc.plus.support.parametersource.MutableSqlIdentifierParameterSource; import com.navercorp.spring.jdbc.plus.support.parametersource.ConvertibleParameterSourceFactory; /** @@ -72,7 +73,7 @@ public MapSqlParameterSource mapParameterSource(Map map) { @Override public SqlParameterSource entityParameterSource(Object entity) { - SqlIdentifierParameterSource parameterSource = new ConvertibleSqlIdentifierParameterSource( + MutableSqlIdentifierParameterSource parameterSource = new ConvertibleSqlIdentifierParameterSource( this.delegate.getConverter(), this.delegate.getFallback()); RelationalPersistentEntity persistentEntity = this.mappingContext.getRequiredPersistentEntity(entity.getClass()); diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/EntitySqlParameterSourceApplier.java b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/EntitySqlParameterSourceApplier.java index a7104e03..22e3bae7 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/EntitySqlParameterSourceApplier.java +++ b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/EntitySqlParameterSourceApplier.java @@ -30,6 +30,8 @@ import org.springframework.data.relational.core.sql.SqlIdentifier; import org.springframework.lang.Nullable; +import com.navercorp.spring.data.jdbc.plus.support.parametersource.MutableSqlIdentifierParameterSource; + /** * The type Entity sql parameter source applier. * @@ -60,7 +62,7 @@ class EntitySqlParameterSourceApplier { */ // DefaultDataAccessStrategy#getParameterSource void addParameterSource( - SqlIdentifierParameterSource parameterSource, + MutableSqlIdentifierParameterSource parameterSource, Object instance, RelationalPersistentEntity persistentEntity, String prefix @@ -94,7 +96,7 @@ void addParameterSource( // DefaultDataAccessStrategy#addConvertedPropertyValue private void addConvertedPropertyValue( - SqlIdentifierParameterSource parameterSource, + MutableSqlIdentifierParameterSource parameterSource, RelationalPersistentProperty property, Object value, SqlIdentifier name diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/provider/EntityJdbcProvider.java b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/provider/EntityJdbcProvider.java index 1bc41ff4..dfdb9132 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/provider/EntityJdbcProvider.java +++ b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/provider/EntityJdbcProvider.java @@ -31,11 +31,10 @@ import org.springframework.jdbc.core.namedparam.SqlParameterSource; import com.navercorp.spring.data.jdbc.plus.sql.convert.AggregateResultSetExtractor; -import com.navercorp.spring.data.jdbc.plus.sql.convert.SqlProvider; +import com.navercorp.spring.data.jdbc.plus.support.convert.SqlProvider; import com.navercorp.spring.data.jdbc.plus.sql.parametersource.EntityConvertibleSqlParameterSourceFactory; import com.navercorp.spring.data.jdbc.plus.sql.parametersource.SqlParameterSourceFactory; import com.navercorp.spring.jdbc.plus.support.parametersource.CompositeSqlParameterSource; -import com.navercorp.spring.jdbc.plus.support.parametersource.ConvertibleParameterSourceFactory; /** * The type Entity jdbc provider. diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/support/SqlAware.java b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/support/SqlAware.java index f372eb87..c5805e8e 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/support/SqlAware.java +++ b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/support/SqlAware.java @@ -18,7 +18,7 @@ package com.navercorp.spring.data.jdbc.plus.sql.support; -import com.navercorp.spring.data.jdbc.plus.sql.convert.SqlProvider; +import com.navercorp.spring.data.jdbc.plus.support.convert.SqlProvider; /** * The interface Sql aware. diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/support/SqlGeneratorSupport.java b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/support/SqlGeneratorSupport.java index 9081cca7..54b21f53 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/support/SqlGeneratorSupport.java +++ b/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/support/SqlGeneratorSupport.java @@ -18,7 +18,7 @@ package com.navercorp.spring.data.jdbc.plus.sql.support; -import com.navercorp.spring.data.jdbc.plus.sql.convert.SqlProvider; +import com.navercorp.spring.data.jdbc.plus.support.convert.SqlProvider; /** * The type Sql generator support. diff --git a/spring-data-jdbc-plus-support/build.gradle b/spring-data-jdbc-plus-support/build.gradle new file mode 100644 index 00000000..2b14b143 --- /dev/null +++ b/spring-data-jdbc-plus-support/build.gradle @@ -0,0 +1,19 @@ +compileJava.dependsOn(processResources) + +dependencies { + api(project(":spring-jdbc-plus-commons")) + + api("org.springframework.data:spring-data-commons") + api("org.springframework.data:spring-data-jdbc") + api("org.springframework.data:spring-data-relational") + + testImplementation("org.junit.jupiter:junit-jupiter") + testImplementation("org.junit.jupiter:junit-jupiter-api") + testImplementation("org.junit.jupiter:junit-jupiter-params") + testImplementation("org.junit.jupiter:junit-jupiter-engine") + testImplementation("org.assertj:assertj-core:3.23.1") + testImplementation("org.mockito:mockito-junit-jupiter") + + testRuntimeOnly("org.junit.platform:junit-platform-launcher") + testRuntimeOnly("org.junit.platform:junit-platform-commons") +} diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/PropertyPathUtils.java b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/PropertyPathUtils.java similarity index 90% rename from spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/PropertyPathUtils.java rename to spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/PropertyPathUtils.java index f59620a5..295b28f0 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/PropertyPathUtils.java +++ b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/PropertyPathUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.navercorp.spring.data.jdbc.plus.sql.convert; +package com.navercorp.spring.data.jdbc.plus.support.convert; import javax.annotation.Nullable; @@ -36,7 +36,7 @@ public class PropertyPathUtils { * @param path * @return */ - static SqlIdentifier getColumnAlias(AggregatePath path) { + public static SqlIdentifier getColumnAlias(AggregatePath path) { return getColumnAlias(path, path.getColumnInfo().name()); } @@ -47,7 +47,7 @@ static SqlIdentifier getColumnAlias(AggregatePath path) { * @param columnName * @return */ - static SqlIdentifier getColumnAlias(AggregatePath path, SqlIdentifier columnName) { + public static SqlIdentifier getColumnAlias(AggregatePath path, SqlIdentifier columnName) { AggregatePath tableOwner = getTableOwningAncestor(path); if (tableOwner.isRoot()) { return columnName; @@ -64,7 +64,7 @@ static SqlIdentifier getColumnAlias(AggregatePath path, SqlIdentifier columnName * @param path * @return */ - static SqlIdentifier getReverseColumnAlias(AggregatePath path) { + public static SqlIdentifier getReverseColumnAlias(AggregatePath path) { return getReverseColumnAlias(path, path.getTableInfo().reverseColumnInfo().name()); } @@ -75,7 +75,7 @@ static SqlIdentifier getReverseColumnAlias(AggregatePath path) { * @param reverseColumnName * @return */ - static SqlIdentifier getReverseColumnAlias( + public static SqlIdentifier getReverseColumnAlias( AggregatePath path, SqlIdentifier reverseColumnName ) { @@ -93,7 +93,7 @@ static SqlIdentifier getReverseColumnAlias( * @return */ @Nullable - static SqlIdentifier getTableAlias(AggregatePath path) { + public static SqlIdentifier getTableAlias(AggregatePath path) { AggregatePath tableOwner = getTableOwningAncestor(path); return getTableAliasFromTableOwner(tableOwner); } diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SoftDeleteProperty.java b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SoftDeleteProperty.java similarity index 96% rename from spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SoftDeleteProperty.java rename to spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SoftDeleteProperty.java index 07c3e66b..37a76581 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SoftDeleteProperty.java +++ b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SoftDeleteProperty.java @@ -1,4 +1,4 @@ -package com.navercorp.spring.data.jdbc.plus.sql.convert; +package com.navercorp.spring.data.jdbc.plus.support.convert; import java.util.Arrays; @@ -8,7 +8,7 @@ import org.springframework.lang.Nullable; import org.springframework.util.StringUtils; -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SoftDeleteColumn; +import com.navercorp.spring.jdbc.plus.commons.annotations.SoftDeleteColumn; /** * A property to generate sql for soft delete. @@ -30,6 +30,7 @@ private SoftDeleteProperty(boolean exists, SqlIdentifier columnName, @Nullable O this.updateValue = updateValue; } + static SoftDeleteProperty from(RelationalPersistentEntity entity) { RelationalPersistentProperty softDeleteProperty = findSoftDeleteProperty(entity); if (softDeleteProperty == null) { diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlContext.java b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlContext.java similarity index 98% rename from spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlContext.java rename to spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlContext.java index 38e0fb45..b7a62306 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlContext.java +++ b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlContext.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.navercorp.spring.data.jdbc.plus.sql.convert; +package com.navercorp.spring.data.jdbc.plus.support.convert; import org.springframework.data.relational.core.mapping.AggregatePath; import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlContexts.java b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlContexts.java similarity index 96% rename from spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlContexts.java rename to spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlContexts.java index 65b8f25c..3b1973de 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlContexts.java +++ b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlContexts.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package com.navercorp.spring.data.jdbc.plus.sql.convert; +package com.navercorp.spring.data.jdbc.plus.support.convert; import org.springframework.data.relational.core.mapping.AggregatePath; import org.springframework.data.relational.core.sql.Column; diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGenerator.java b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGenerator.java similarity index 99% rename from spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGenerator.java rename to spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGenerator.java index 9709986a..139233f4 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGenerator.java +++ b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGenerator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.navercorp.spring.data.jdbc.plus.sql.convert; +package com.navercorp.spring.data.jdbc.plus.support.convert; import java.lang.reflect.Constructor; import java.util.ArrayList; @@ -86,8 +86,8 @@ import org.springframework.lang.Nullable; import org.springframework.util.Assert; -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SqlFunction; -import com.navercorp.spring.data.jdbc.plus.sql.parametersource.BindParameterNameSanitizer; +import com.navercorp.spring.data.jdbc.plus.support.parametersource.BindParameterNameSanitizer; +import com.navercorp.spring.jdbc.plus.commons.annotations.SqlFunction; /** * Generates SQL statements to be used by {@link org.springframework.data.jdbc.repository.support.SimpleJdbcRepository} diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGeneratorSource.java b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGeneratorSource.java similarity index 97% rename from spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGeneratorSource.java rename to spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGeneratorSource.java index 0648505a..6b3c1b46 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGeneratorSource.java +++ b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGeneratorSource.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.navercorp.spring.data.jdbc.plus.sql.convert; +package com.navercorp.spring.data.jdbc.plus.support.convert; import java.util.Map; import java.util.function.Function; diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlProvider.java b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlProvider.java similarity index 98% rename from spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlProvider.java rename to spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlProvider.java index 2018b3cc..8085f658 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlProvider.java +++ b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlProvider.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package com.navercorp.spring.data.jdbc.plus.sql.convert; +package com.navercorp.spring.data.jdbc.plus.support.convert; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/TableAliasUtils.java b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/TableAliasUtils.java similarity index 93% rename from spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/TableAliasUtils.java rename to spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/TableAliasUtils.java index 7b3ea51d..80d4c756 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/convert/TableAliasUtils.java +++ b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/convert/TableAliasUtils.java @@ -1,4 +1,4 @@ -package com.navercorp.spring.data.jdbc.plus.sql.convert; +package com.navercorp.spring.data.jdbc.plus.support.convert; import javax.annotation.Nullable; @@ -8,7 +8,7 @@ import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; import org.springframework.data.relational.core.sql.SqlIdentifier; -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SqlTableAlias; +import com.navercorp.spring.jdbc.plus.commons.annotations.SqlTableAlias; /** * TableAliasUtils to get table alias applied @SqlTableAlias diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/BindParameterNameSanitizer.java b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/parametersource/BindParameterNameSanitizer.java similarity index 87% rename from spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/BindParameterNameSanitizer.java rename to spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/parametersource/BindParameterNameSanitizer.java index 877f444b..d8364243 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/BindParameterNameSanitizer.java +++ b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/parametersource/BindParameterNameSanitizer.java @@ -1,4 +1,4 @@ -package com.navercorp.spring.data.jdbc.plus.sql.parametersource; +package com.navercorp.spring.data.jdbc.plus.support.parametersource; import java.util.regex.Pattern; diff --git a/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/parametersource/MutableSqlIdentifierParameterSource.java b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/parametersource/MutableSqlIdentifierParameterSource.java new file mode 100644 index 00000000..287fe4e5 --- /dev/null +++ b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/parametersource/MutableSqlIdentifierParameterSource.java @@ -0,0 +1,21 @@ +package com.navercorp.spring.data.jdbc.plus.support.parametersource; + +import java.util.Set; + +import org.springframework.data.relational.core.sql.SqlIdentifier; +import org.springframework.jdbc.core.namedparam.SqlParameterSource; + +public interface MutableSqlIdentifierParameterSource extends SqlParameterSource { + + static MutableSqlIdentifierParameterSource create() { + return new SqlIdentifierParameterSource(); + } + + Set getIdentifiers(); + + void addValue(SqlIdentifier name, Object value); + + void addValue(SqlIdentifier identifier, Object value, int sqlType); + + void addAll(MutableSqlIdentifierParameterSource others); +} diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/SqlIdentifierParameterSource.java b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/parametersource/SqlIdentifierParameterSource.java similarity index 82% rename from spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/SqlIdentifierParameterSource.java rename to spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/parametersource/SqlIdentifierParameterSource.java index 6abb8522..132b454a 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/parametersource/SqlIdentifierParameterSource.java +++ b/spring-data-jdbc-plus-support/src/main/java/com/navercorp/spring/data/jdbc/plus/support/parametersource/SqlIdentifierParameterSource.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package com.navercorp.spring.data.jdbc.plus.sql.parametersource; +package com.navercorp.spring.data.jdbc.plus.support.parametersource; import java.util.Collections; import java.util.HashMap; @@ -37,7 +37,9 @@ * * COPY: org.springframework.data.jdbc.core.convert.SqlIdentifierParameterSource */ -class SqlIdentifierParameterSource extends AbstractSqlParameterSource { +class SqlIdentifierParameterSource + extends AbstractSqlParameterSource + implements MutableSqlIdentifierParameterSource { private final Set identifiers = new HashSet<>(); private final Map namesToValues = new HashMap<>(); @@ -56,15 +58,18 @@ public String[] getParameterNames() { return namesToValues.keySet().toArray(new String[0]); } - Set getIdentifiers() { + @Override + public Set getIdentifiers() { return Collections.unmodifiableSet(identifiers); } - void addValue(SqlIdentifier name, Object value) { + @Override + public void addValue(SqlIdentifier name, Object value) { addValue(name, value, Integer.MIN_VALUE); } - void addValue(SqlIdentifier identifier, Object value, int sqlType) { + @Override + public void addValue(SqlIdentifier identifier, Object value, int sqlType) { identifiers.add(identifier); String name = BindParameterNameSanitizer.sanitize(identifier.getReference()); @@ -72,7 +77,8 @@ void addValue(SqlIdentifier identifier, Object value, int sqlType) { registerSqlType(name, sqlType); } - void addAll(SqlIdentifierParameterSource others) { + @Override + public void addAll(MutableSqlIdentifierParameterSource others) { for (SqlIdentifier identifier : others.getIdentifiers()) { diff --git a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/NonQuotingDialect.java b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/NonQuotingDialect.java similarity index 94% rename from spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/NonQuotingDialect.java rename to spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/NonQuotingDialect.java index d77b510a..6ca3642c 100644 --- a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/NonQuotingDialect.java +++ b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/NonQuotingDialect.java @@ -1,4 +1,4 @@ -package com.navercorp.spring.data.jdbc.plus.sql.convert; +package com.navercorp.spring.data.jdbc.plus.support.convert; import org.springframework.data.relational.core.dialect.AbstractDialect; import org.springframework.data.relational.core.dialect.Dialect; diff --git a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/PersistentPropertyPathTestUtils.java b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/PersistentPropertyPathTestUtils.java similarity index 93% rename from spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/PersistentPropertyPathTestUtils.java rename to spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/PersistentPropertyPathTestUtils.java index 0b2ef81b..91410ac3 100644 --- a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/PersistentPropertyPathTestUtils.java +++ b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/PersistentPropertyPathTestUtils.java @@ -1,4 +1,4 @@ -package com.navercorp.spring.data.jdbc.plus.sql.convert; +package com.navercorp.spring.data.jdbc.plus.support.convert; import org.springframework.data.mapping.PersistentPropertyPath; import org.springframework.data.relational.core.mapping.RelationalMappingContext; diff --git a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/PropertyPathTestingUtils.java b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/PropertyPathTestingUtils.java similarity index 93% rename from spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/PropertyPathTestingUtils.java rename to spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/PropertyPathTestingUtils.java index 2ba1eafa..c513f074 100644 --- a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/PropertyPathTestingUtils.java +++ b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/PropertyPathTestingUtils.java @@ -1,4 +1,4 @@ -package com.navercorp.spring.data.jdbc.plus.sql.convert; +package com.navercorp.spring.data.jdbc.plus.support.convert; import org.springframework.data.mapping.PersistentPropertyPath; import org.springframework.data.mapping.PersistentPropertyPaths; diff --git a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SoftDeletePropertyTest.java b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SoftDeletePropertyTest.java similarity index 96% rename from spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SoftDeletePropertyTest.java rename to spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SoftDeletePropertyTest.java index 11a03b38..18fcaeba 100644 --- a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SoftDeletePropertyTest.java +++ b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SoftDeletePropertyTest.java @@ -1,4 +1,4 @@ -package com.navercorp.spring.data.jdbc.plus.sql.convert; +package com.navercorp.spring.data.jdbc.plus.support.convert; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -15,7 +15,7 @@ import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; import org.springframework.data.relational.core.mapping.Table; -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SoftDeleteColumn; +import com.navercorp.spring.jdbc.plus.commons.annotations.SoftDeleteColumn; class SoftDeletePropertyTest { diff --git a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGeneratorContextBasedNamingStrategyTest.java b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGeneratorContextBasedNamingStrategyTest.java similarity index 97% rename from spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGeneratorContextBasedNamingStrategyTest.java rename to spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGeneratorContextBasedNamingStrategyTest.java index a8fca06d..5b3f6d7b 100644 --- a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGeneratorContextBasedNamingStrategyTest.java +++ b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGeneratorContextBasedNamingStrategyTest.java @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.navercorp.spring.data.jdbc.plus.sql.convert; +package com.navercorp.spring.data.jdbc.plus.support.convert; -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; diff --git a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGeneratorEmbeddedTest.java b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGeneratorEmbeddedTest.java similarity index 97% rename from spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGeneratorEmbeddedTest.java rename to spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGeneratorEmbeddedTest.java index b8870818..a9b1d505 100644 --- a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGeneratorEmbeddedTest.java +++ b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGeneratorEmbeddedTest.java @@ -1,9 +1,11 @@ -package com.navercorp.spring.data.jdbc.plus.sql.convert; - -import static java.util.Collections.*; -import static org.assertj.core.api.Assertions.*; -import static org.springframework.data.relational.core.mapping.Embedded.*; -import static org.springframework.data.relational.core.sql.SqlIdentifier.*; +package com.navercorp.spring.data.jdbc.plus.support.convert; + +import static java.util.Collections.emptySet; +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.data.relational.core.mapping.Embedded.Nullable; +import static org.springframework.data.relational.core.mapping.Embedded.OnEmpty; +import static org.springframework.data.relational.core.sql.SqlIdentifier.quoted; +import static org.springframework.data.relational.core.sql.SqlIdentifier.unquoted; import org.assertj.core.api.SoftAssertions; import org.junit.jupiter.api.BeforeEach; diff --git a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGeneratorFixedNamingStrategyTest.java b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGeneratorFixedNamingStrategyTest.java similarity index 98% rename from spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGeneratorFixedNamingStrategyTest.java rename to spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGeneratorFixedNamingStrategyTest.java index c0c7be6a..8ceecaa4 100644 --- a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGeneratorFixedNamingStrategyTest.java +++ b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGeneratorFixedNamingStrategyTest.java @@ -1,6 +1,6 @@ -package com.navercorp.spring.data.jdbc.plus.sql.convert; +package com.navercorp.spring.data.jdbc.plus.support.convert; -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; import org.assertj.core.api.SoftAssertions; import org.junit.jupiter.api.Test; diff --git a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGeneratorTest.java b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGeneratorTest.java similarity index 98% rename from spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGeneratorTest.java rename to spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGeneratorTest.java index 94841a0d..66f176db 100644 --- a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlGeneratorTest.java +++ b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlGeneratorTest.java @@ -1,8 +1,10 @@ -package com.navercorp.spring.data.jdbc.plus.sql.convert; +package com.navercorp.spring.data.jdbc.plus.support.convert; -import static java.util.Collections.*; -import static org.assertj.core.api.Assertions.*; -import static org.springframework.data.relational.core.sql.SqlIdentifier.*; +import static java.util.Collections.emptySet; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.springframework.data.relational.core.sql.SqlIdentifier.quoted; +import static org.springframework.data.relational.core.sql.SqlIdentifier.unquoted; import java.util.Map; import java.util.Set; @@ -37,9 +39,9 @@ import org.springframework.data.relational.core.sql.SqlIdentifier; import org.springframework.data.relational.core.sql.TableLike; -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SoftDeleteColumn; -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SoftDeleteColumn.ValueType; -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SqlTableAlias; +import com.navercorp.spring.jdbc.plus.commons.annotations.SoftDeleteColumn; +import com.navercorp.spring.jdbc.plus.commons.annotations.SoftDeleteColumn.ValueType; +import com.navercorp.spring.jdbc.plus.commons.annotations.SqlTableAlias; /** * COPY org.springframework.data.relational.core.convert.SqlGeneratorUnitTests diff --git a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlProviderTest.java b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlProviderTest.java similarity index 98% rename from spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlProviderTest.java rename to spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlProviderTest.java index c64dd634..caf2c0cc 100644 --- a/spring-data-jdbc-plus-sql/src/test/java/com/navercorp/spring/data/jdbc/plus/sql/convert/SqlProviderTest.java +++ b/spring-data-jdbc-plus-support/src/test/java/com/navercorp/spring/data/jdbc/plus/support/convert/SqlProviderTest.java @@ -16,9 +16,9 @@ * limitations under the License. */ -package com.navercorp.spring.data.jdbc.plus.sql.convert; +package com.navercorp.spring.data.jdbc.plus.support.convert; -import static org.assertj.core.api.AssertionsForClassTypes.*; +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -33,8 +33,8 @@ import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; import org.springframework.data.relational.core.mapping.Table; -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SqlFunction; -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SqlTableAlias; +import com.navercorp.spring.jdbc.plus.commons.annotations.SqlFunction; +import com.navercorp.spring.jdbc.plus.commons.annotations.SqlTableAlias; /** * @author Myeonghyeon Lee diff --git a/spring-data-plus-sql-gen/src/main/java/com/navercorp/spring/data/plus/sql/gen/SpringDataTableGenerator.java b/spring-data-plus-sql-gen/src/main/java/com/navercorp/spring/data/plus/sql/gen/SpringDataTableGenerator.java index 0bbe2e4d..f62225d7 100644 --- a/spring-data-plus-sql-gen/src/main/java/com/navercorp/spring/data/plus/sql/gen/SpringDataTableGenerator.java +++ b/spring-data-plus-sql-gen/src/main/java/com/navercorp/spring/data/plus/sql/gen/SpringDataTableGenerator.java @@ -55,10 +55,10 @@ import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; -import com.navercorp.spring.data.jdbc.plus.sql.annotation.SqlFunction; import com.navercorp.spring.data.plus.sql.gen.annotation.GeneratedTable; import com.navercorp.spring.data.plus.sql.gen.column.TbColumn; import com.navercorp.spring.data.plus.sql.gen.column.TbInfo; +import com.navercorp.spring.jdbc.plus.commons.annotations.SqlFunction; /** * The type Spring data table generator. diff --git a/spring-jdbc-plus-commons/build.gradle b/spring-jdbc-plus-commons/build.gradle new file mode 100644 index 00000000..9e2969af --- /dev/null +++ b/spring-jdbc-plus-commons/build.gradle @@ -0,0 +1,15 @@ +compileJava.dependsOn(processResources) + +dependencies { + implementation("org.springframework:spring-core") + + testImplementation("org.junit.jupiter:junit-jupiter") + testImplementation("org.junit.jupiter:junit-jupiter-api") + testImplementation("org.junit.jupiter:junit-jupiter-params") + testImplementation("org.junit.jupiter:junit-jupiter-engine") + testImplementation("org.assertj:assertj-core:3.23.1") + testImplementation("org.mockito:mockito-junit-jupiter") + + testRuntimeOnly("org.junit.platform:junit-platform-launcher") + testRuntimeOnly("org.junit.platform:junit-platform-commons") +} diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/annotation/SoftDeleteColumn.java b/spring-jdbc-plus-commons/src/main/java/com/navercorp/spring/jdbc/plus/commons/annotations/SoftDeleteColumn.java similarity index 97% rename from spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/annotation/SoftDeleteColumn.java rename to spring-jdbc-plus-commons/src/main/java/com/navercorp/spring/jdbc/plus/commons/annotations/SoftDeleteColumn.java index 27cc086c..d5f3861c 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/annotation/SoftDeleteColumn.java +++ b/spring-jdbc-plus-commons/src/main/java/com/navercorp/spring/jdbc/plus/commons/annotations/SoftDeleteColumn.java @@ -1,4 +1,4 @@ -package com.navercorp.spring.data.jdbc.plus.sql.annotation; +package com.navercorp.spring.jdbc.plus.commons.annotations; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/annotation/SqlFunction.java b/spring-jdbc-plus-commons/src/main/java/com/navercorp/spring/jdbc/plus/commons/annotations/SqlFunction.java similarity index 96% rename from spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/annotation/SqlFunction.java rename to spring-jdbc-plus-commons/src/main/java/com/navercorp/spring/jdbc/plus/commons/annotations/SqlFunction.java index a060e84c..5e792fc5 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/annotation/SqlFunction.java +++ b/spring-jdbc-plus-commons/src/main/java/com/navercorp/spring/jdbc/plus/commons/annotations/SqlFunction.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package com.navercorp.spring.data.jdbc.plus.sql.annotation; +package com.navercorp.spring.jdbc.plus.commons.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/annotation/SqlTableAlias.java b/spring-jdbc-plus-commons/src/main/java/com/navercorp/spring/jdbc/plus/commons/annotations/SqlTableAlias.java similarity index 94% rename from spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/annotation/SqlTableAlias.java rename to spring-jdbc-plus-commons/src/main/java/com/navercorp/spring/jdbc/plus/commons/annotations/SqlTableAlias.java index 5e01ff4c..9b0d4632 100644 --- a/spring-data-jdbc-plus-sql/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/annotation/SqlTableAlias.java +++ b/spring-jdbc-plus-commons/src/main/java/com/navercorp/spring/jdbc/plus/commons/annotations/SqlTableAlias.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package com.navercorp.spring.data.jdbc.plus.sql.annotation; +package com.navercorp.spring.jdbc.plus.commons.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention;