Skip to content

Commit

Permalink
Merge pull request #9 from naver/apply-spring-data-jdbc-2.0.0
Browse files Browse the repository at this point in the history
Reviewed by: @benelog @sanha
  • Loading branch information
Myeonghyeon-Lee authored May 13, 2020
2 parents 06de081 + fe0788a commit c837d3c
Show file tree
Hide file tree
Showing 16 changed files with 107 additions and 57 deletions.
4 changes: 2 additions & 2 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spring-projects/spring-data-commons
https://github.com/spring-projects/spring-data-commons


Spring Data Commons 2.2 RC2
Spring Data Commons 2.3.0.RELEASE
Copyright (c) [2010-2019] Pivotal Software, Inc.

This product is licensed to you under the Apache License, Version 2.0 (the "License").
Expand Down Expand Up @@ -71,7 +71,7 @@ spring-projects/spring-data-jdbc
https://github.com/spring-projects/spring-data-jdbc


Spring Data JDBC 1.1 RC2
Spring Data JDBC 2.0.0.RELEASE
Copyright (c) [2017-2019] Pivotal Software, Inc.

This product is licensed to you under the Apache License, Version 2.0 (the "License").
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ buildscript {
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.6.RELEASE")
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.7.RELEASE")
}
}
dependencies {
implementation("com.navercorp.spring:spring-boot-starter-data-jdbc-plus-sql:2.0.0.RC2")
implementation("org.springframework.data:spring-data-jdbc:2.0.0.RC2")
implementation("org.springframework.data:spring-data-relational:2.0.0.RC2")
implementation("org.springframework.data:spring-data-commons:2.3.0.RC2")
implementation("com.navercorp.spring:spring-boot-starter-data-jdbc-plus-sql:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-jdbc:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-relational:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-commons:2.3.0.RELEASE")
}
```

Expand All @@ -51,22 +51,22 @@ dependencies {
<dependency>
<groupId>com.navercorp.spring</groupId>
<artifactId>spring-boot-starter-data-jdbc-plus-sql</artifactId>
<version>2.0.0.RC2</version>
<version>2.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jdbc</artifactId>
<version>2.0.0.RC2</version>
<version>2.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-relational</artifactId>
<version>2.0.0.RC2</version>
<version>2.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>2.3.0.RC2</version>
<version>2.3.0.RELEASE</version>
</dependency>
```

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ buildscript {
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.6.RELEASE")
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.7.RELEASE")
}
}

allprojects {
group = "com.navercorp.spring"
version = "2.0.0.RC3-SNAPSHOT"
version = "2.0.0.RELEASE"
}

subprojects {
Expand Down
6 changes: 3 additions & 3 deletions guide-projects/plus-repository-guide/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ dependencies {
implementation("org.projectlombok:lombok")
annotationProcessor("org.projectlombok:lombok")

implementation("org.springframework.data:spring-data-jdbc:2.0.0.RC2")
implementation("org.springframework.data:spring-data-relational:2.0.0.RC2")
implementation("org.springframework.data:spring-data-commons:2.3.0.RC2")
implementation("org.springframework.data:spring-data-jdbc:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-relational:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-commons:2.3.0.RELEASE")

testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude group: "org.junit.vintage", module: "junit-vintage-engine"
Expand Down
12 changes: 6 additions & 6 deletions guide-projects/plus-sql-java-groovy-guide/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ dependencies {
implementation("org.codehaus.groovy:groovy:2.5.8")
implementation("com.h2database:h2")

implementation("org.springframework.data:spring-data-jdbc:2.0.0.RC2")
implementation("org.springframework.data:spring-data-relational:2.0.0.RC2")
implementation("org.springframework.data:spring-data-commons:2.3.0.RC2")
implementation("org.springframework.data:spring-data-jdbc:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-relational:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-commons:2.3.0.RELEASE")

implementation project(":spring-data-plus-sql-gen")
annotationProcessor project(":spring-data-plus-sql-gen")
annotationProcessor("org.springframework.data:spring-data-jdbc:2.0.0.RC2")
annotationProcessor("org.springframework.data:spring-data-relational:2.0.0.RC2")
annotationProcessor("org.springframework.data:spring-data-commons:2.3.0.RC2")
annotationProcessor("org.springframework.data:spring-data-jdbc:2.0.0.RELEASE")
annotationProcessor("org.springframework.data:spring-data-relational:2.0.0.RELEASE")
annotationProcessor("org.springframework.data:spring-data-commons:2.3.0.RELEASE")

compileOnly("org.projectlombok:lombok")
annotationProcessor("org.projectlombok:lombok")
Expand Down
6 changes: 3 additions & 3 deletions guide-projects/plus-sql-java-kotlin-guide/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ dependencies {
implementation("org.projectlombok:lombok")
annotationProcessor("org.projectlombok:lombok")

implementation("org.springframework.data:spring-data-jdbc:2.0.0.RC2")
implementation("org.springframework.data:spring-data-relational:2.0.0.RC2")
implementation("org.springframework.data:spring-data-commons:2.3.0.RC2")
implementation("org.springframework.data:spring-data-jdbc:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-relational:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-commons:2.3.0.RELEASE")

testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude group: "org.junit.vintage", module: "junit-vintage-engine"
Expand Down
6 changes: 3 additions & 3 deletions guide-projects/plus-sql-kotlin-guide/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("com.h2database:h2")

implementation("org.springframework.data:spring-data-jdbc:2.0.0.RC2")
implementation("org.springframework.data:spring-data-relational:2.0.0.RC2")
implementation("org.springframework.data:spring-data-commons:2.3.0.RC2")
implementation("org.springframework.data:spring-data-jdbc:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-relational:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-commons:2.3.0.RELEASE")

testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
Expand Down
6 changes: 3 additions & 3 deletions spring-boot-autoconfigure-data-jdbc-plus/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ dependencies {
implementation project(":spring-data-jdbc-plus-sql")
implementation project(":spring-data-jdbc-plus-repository")

implementation("org.springframework.data:spring-data-jdbc:2.0.0.RC2")
implementation("org.springframework.data:spring-data-relational:2.0.0.RC2")
implementation("org.springframework.data:spring-data-commons:2.3.0.RC2")
implementation("org.springframework.data:spring-data-jdbc:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-relational:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-commons:2.3.0.RELEASE")
implementation("io.projectreactor:reactor-core")

testImplementation("org.junit.jupiter:junit-jupiter")
Expand Down
6 changes: 3 additions & 3 deletions spring-boot-starter-data-jdbc-plus-repository/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dependencies {
compile(project(":spring-data-jdbc-plus-repository"))
compile("org.springframework.boot:spring-boot-starter-jdbc")

implementation("org.springframework.data:spring-data-jdbc:2.0.0.RC2")
implementation("org.springframework.data:spring-data-relational:2.0.0.RC2")
implementation("org.springframework.data:spring-data-commons:2.3.0.RC2")
implementation("org.springframework.data:spring-data-jdbc:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-relational:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-commons:2.3.0.RELEASE")
}
6 changes: 3 additions & 3 deletions spring-boot-starter-data-jdbc-plus-sql/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dependencies {
compile(project(":spring-data-jdbc-plus-sql"))
compile("org.springframework.boot:spring-boot-starter-jdbc")

implementation("org.springframework.data:spring-data-jdbc:2.0.0.RC2")
implementation("org.springframework.data:spring-data-relational:2.0.0.RC2")
implementation("org.springframework.data:spring-data-commons:2.3.0.RC2")
implementation("org.springframework.data:spring-data-jdbc:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-relational:2.0.0.RELEASE")
implementation("org.springframework.data:spring-data-commons:2.3.0.RELEASE")
}
6 changes: 3 additions & 3 deletions spring-data-jdbc-plus-repository/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
compileJava.dependsOn(processResources)

dependencies {
compile("org.springframework.data:spring-data-jdbc:2.0.0.RC2")
compile("org.springframework.data:spring-data-relational:2.0.0.RC2")
compile("org.springframework.data:spring-data-commons:2.3.0.RC2")
compile("org.springframework.data:spring-data-jdbc:2.0.0.RELEASE")
compile("org.springframework.data:spring-data-relational:2.0.0.RELEASE")
compile("org.springframework.data:spring-data-commons:2.3.0.RELEASE")

testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.junit.jupiter:junit-jupiter-api")
Expand Down
6 changes: 3 additions & 3 deletions spring-data-jdbc-plus-sql/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ compileJava.dependsOn(processResources)

dependencies {
compile project(":spring-jdbc-plus-support")
compile("org.springframework.data:spring-data-jdbc:2.0.0.RC2")
compile("org.springframework.data:spring-data-relational:2.0.0.RC2")
compile("org.springframework.data:spring-data-commons:2.3.0.RC2")
compile("org.springframework.data:spring-data-jdbc:2.0.0.RELEASE")
compile("org.springframework.data:spring-data-relational:2.0.0.RELEASE")
compile("org.springframework.data:spring-data-commons:2.3.0.RELEASE")
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.70")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.3.70")
implementation("io.projectreactor:reactor-core")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@
import org.springframework.data.relational.core.sql.DeleteBuilder;
import org.springframework.data.relational.core.sql.Expression;
import org.springframework.data.relational.core.sql.Expressions;
import org.springframework.data.relational.core.sql.From;
import org.springframework.data.relational.core.sql.Functions;
import org.springframework.data.relational.core.sql.Insert;
import org.springframework.data.relational.core.sql.InsertBuilder;
import org.springframework.data.relational.core.sql.LockMode;
import org.springframework.data.relational.core.sql.OrderByField;
import org.springframework.data.relational.core.sql.SQL;
import org.springframework.data.relational.core.sql.Select;
Expand Down Expand Up @@ -1040,7 +1042,8 @@ Set<SqlIdentifier> getUpdateableColumns() {
}

/**
* DIFF
* DIFF: org.springframework.data.relational.core.sql.DefaultSelect
* Only support Select columns for selectColumns
*/
class SimpleSelect implements Select {

Expand All @@ -1064,6 +1067,11 @@ public void visit(Visitor visitor) {
visitor.leave(this);
}

@Override
public From getFrom() {
throw new UnsupportedOperationException("SimpleSelect does not support from clause.");
}

@Override
public List<OrderByField> getOrderBy() {
return Collections.emptyList();
Expand All @@ -1083,5 +1091,10 @@ public OptionalLong getOffset() {
public boolean isDistinct() {
return false;
}

@Override
public LockMode getLockMode() {
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import org.springframework.data.relational.core.dialect.AbstractDialect;
import org.springframework.data.relational.core.dialect.ArrayColumns;
import org.springframework.data.relational.core.dialect.LimitClause;
import org.springframework.data.relational.core.dialect.LockClause;
import org.springframework.data.relational.core.sql.IdentifierProcessing;
import org.springframework.data.relational.core.sql.LockOptions;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;

Expand All @@ -18,6 +20,9 @@ public class AnsiDialect extends AbstractDialect {
* Singleton instance.
*/
public static final AnsiDialect INSTANCE = new AnsiDialect();

protected AnsiDialect() {}

private static final LimitClause LIMIT_CLAUSE = new LimitClause() {

/*
Expand Down Expand Up @@ -56,10 +61,29 @@ public Position getClausePosition() {
return Position.AFTER_ORDER_BY;
}
};
private final AnsiArrayColumns arrayColumns = new AnsiArrayColumns();

protected AnsiDialect() {
}
static final LockClause LOCK_CLAUSE = new LockClause() {

/*
* (non-Javadoc)
* @see org.springframework.data.relational.core.dialect.LockClause#getLock(LockOptions)
*/
@Override
public String getLock(LockOptions lockOptions) {
return "FOR UPDATE";
}

/*
* (non-Javadoc)
* @see org.springframework.data.relational.core.dialect.LimitClause#getClausePosition()
*/
@Override
public Position getClausePosition() {
return Position.AFTER_ORDER_BY;
}
};

private final AnsiArrayColumns ARRAY_COLUMNS = new AnsiArrayColumns();

/*
* (non-Javadoc)
Expand All @@ -72,16 +96,20 @@ public LimitClause limit() {

/*
* (non-Javadoc)
* @see org.springframework.data.relational.core.dialect.Dialect#getArraySupport()
* @see org.springframework.data.relational.core.dialect.Dialect#lock()
*/
@Override
public ArrayColumns getArraySupport() {
return arrayColumns;
public LockClause lock() {
return LOCK_CLAUSE;
}

/*
* (non-Javadoc)
* @see org.springframework.data.relational.core.dialect.Dialect#getArraySupport()
*/
@Override
public IdentifierProcessing getIdentifierProcessing() {
return IdentifierProcessing.ANSI;
public ArrayColumns getArraySupport() {
return ARRAY_COLUMNS;
}

static class AnsiArrayColumns implements ArrayColumns {
Expand All @@ -107,4 +135,9 @@ public Class<?> getArrayType(Class<?> userType) {
return ClassUtils.resolvePrimitiveIfNecessary(userType);
}
}

@Override
public IdentifierProcessing getIdentifierProcessing() {
return IdentifierProcessing.ANSI;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.springframework.data.relational.core.dialect.Dialect;
import org.springframework.data.relational.core.dialect.HsqlDbDialect;
import org.springframework.data.relational.core.dialect.LimitClause;
import org.springframework.data.relational.core.dialect.LockClause;
import org.springframework.data.relational.core.sql.IdentifierProcessing;

/**
Expand All @@ -22,10 +23,13 @@ public LimitClause limit() {
return HsqlDbDialect.INSTANCE.limit();
}

@Override
public LockClause lock() {
return HsqlDbDialect.INSTANCE.lock();
}

@Override
public IdentifierProcessing getIdentifierProcessing() {
return IdentifierProcessing.create(
new IdentifierProcessing.Quoting(""),
IdentifierProcessing.LetterCasing.AS_IS);
return IdentifierProcessing.create(new IdentifierProcessing.Quoting(""), IdentifierProcessing.LetterCasing.AS_IS);
}
}
4 changes: 2 additions & 2 deletions spring-data-plus-sql-gen/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies {
compile("org.springframework.data:spring-data-relational:2.0.0.RC2")
compile("org.springframework.data:spring-data-commons:2.3.0.RC2")
compile("org.springframework.data:spring-data-relational:2.0.0.RELEASE")
compile("org.springframework.data:spring-data-commons:2.3.0.RELEASE")
compile project(":spring-data-jdbc-plus-sql")
compile("com.squareup:javapoet:1.12.1")

Expand Down

0 comments on commit c837d3c

Please sign in to comment.