├── .editorconfig ├── .github └── workflows │ ├── gradle.yml │ └── publish.yml ├── .gitignore ├── LICENSE ├── NOTICE ├── README.md ├── buildSrc ├── build.gradle └── src │ └── main │ └── groovy │ ├── spring.jdbc.plus.java-conventions.gradle │ ├── spring.jdbc.plus.maven-publish-conventions.gradle │ └── spring.jdbc.plus.spring-bom-conventions.gradle ├── doc └── deployment_guide.md ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── guide-projects ├── plus-repository-guide │ ├── build.gradle │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── navercorp │ │ │ │ └── spring │ │ │ │ └── data │ │ │ │ └── jdbc │ │ │ │ └── plus │ │ │ │ └── repository │ │ │ │ └── guide │ │ │ │ ├── Application.java │ │ │ │ ├── article │ │ │ │ ├── BooleanStateArticle.java │ │ │ │ ├── BooleanStateArticleRepository.java │ │ │ │ ├── EnumStateArticle.java │ │ │ │ └── EnumStateArticleRepository.java │ │ │ │ ├── config │ │ │ │ └── JdbcConfiguration.java │ │ │ │ ├── order │ │ │ │ ├── Order.java │ │ │ │ ├── OrderDiscount.java │ │ │ │ ├── OrderItem.java │ │ │ │ ├── OrderRepository.java │ │ │ │ ├── OrderStatus.java │ │ │ │ └── Pricing.java │ │ │ │ ├── product │ │ │ │ ├── PlainProduct.java │ │ │ │ ├── PlainProductRepository.java │ │ │ │ ├── PlainProductWithSoftDeleteReview.java │ │ │ │ ├── PlainProductWithSoftDeleteReviewRepository.java │ │ │ │ ├── PlainReview.java │ │ │ │ ├── SoftDeleteProduct.java │ │ │ │ ├── SoftDeleteProductRepository.java │ │ │ │ ├── SoftDeleteProductWithPlainReview.java │ │ │ │ ├── SoftDeleteProductWithPlainReviewRepository.java │ │ │ │ ├── SoftDeleteReview.java │ │ │ │ └── SoftDeleteReviewRepository.java │ │ │ │ └── shipping │ │ │ │ ├── Shipping.java │ │ │ │ └── ShippingRepository.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── navercorp │ │ │ └── spring │ │ │ └── data │ │ │ └── jdbc │ │ │ └── plus │ │ │ └── repository │ │ │ └── guide │ │ │ ├── ApplicationTest.java │ │ │ ├── article │ │ │ ├── BooleanStateArticleRepositoryTest.java │ │ │ └── EnumStateArticleRepositoryTest.java │ │ │ ├── order │ │ │ └── OrderRepositoryTest.java │ │ │ ├── product │ │ │ ├── PlainProductRepositoryTest.java │ │ │ ├── PlainProductWithSoftDeleteReviewRepositoryTest.java │ │ │ ├── SoftDeleteProductRepositoryTest.java │ │ │ └── SoftDeleteProductWithPlainReviewRepositoryTest.java │ │ │ └── shipping │ │ │ └── ShippingRepositoryTest.java │ │ └── resources │ │ ├── application-test.yml │ │ └── data │ │ └── schema.sql ├── plus-sql-java-groovy-guide │ ├── build.gradle │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── navercorp │ │ │ │ └── spring │ │ │ │ └── data │ │ │ │ └── jdbc │ │ │ │ └── plus │ │ │ │ └── sql │ │ │ │ └── guide │ │ │ │ ├── Application.java │ │ │ │ ├── board │ │ │ │ ├── Board.java │ │ │ │ ├── BoardRepository.java │ │ │ │ ├── BoardRepositoryCustom.java │ │ │ │ ├── BoardRepositoryImpl.java │ │ │ │ ├── PostDto.java │ │ │ │ └── sql │ │ │ │ │ └── BoardSql.groovy │ │ │ │ ├── config │ │ │ │ └── JdbcConfiguration.java │ │ │ │ ├── order │ │ │ │ ├── Order.java │ │ │ │ ├── OrderCriteria.java │ │ │ │ ├── OrderRepository.java │ │ │ │ ├── OrderRepositoryCustom.java │ │ │ │ ├── OrderRepositoryImpl.java │ │ │ │ ├── OrderStatus.java │ │ │ │ ├── UpdatingOrderNameDto.java │ │ │ │ └── sql │ │ │ │ │ └── OrderSql.groovy │ │ │ │ └── support │ │ │ │ └── EmptyStringToNullTraits.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── navercorp │ │ │ └── spring │ │ │ └── data │ │ │ └── jdbc │ │ │ └── plus │ │ │ └── sql │ │ │ └── guide │ │ │ ├── ApplicationTest.java │ │ │ ├── board │ │ │ └── BoardRepositoryTest.java │ │ │ └── order │ │ │ └── OrderRepositoryTest.java │ │ └── resources │ │ ├── application-test.yml │ │ └── data │ │ └── schema.sql ├── plus-sql-java-kotlin-guide │ ├── build.gradle │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── navercorp │ │ │ │ └── spring │ │ │ │ └── data │ │ │ │ └── jdbc │ │ │ │ └── plus │ │ │ │ └── sql │ │ │ │ └── guide │ │ │ │ ├── Application.java │ │ │ │ ├── board │ │ │ │ ├── Board.java │ │ │ │ ├── BoardRepository.java │ │ │ │ ├── BoardRepositoryCustom.java │ │ │ │ ├── BoardRepositoryImpl.java │ │ │ │ ├── PostDto.java │ │ │ │ └── sql │ │ │ │ │ └── BoardSql.kt │ │ │ │ ├── config │ │ │ │ └── JdbcConfig.java │ │ │ │ ├── order │ │ │ │ ├── Order.java │ │ │ │ ├── OrderCriteria.java │ │ │ │ ├── OrderRepository.java │ │ │ │ ├── OrderRepositoryCustom.java │ │ │ │ ├── OrderRepositoryImpl.java │ │ │ │ ├── OrderStatus.java │ │ │ │ └── sql │ │ │ │ │ └── OrderSql.kt │ │ │ │ └── pay │ │ │ │ ├── Pay.java │ │ │ │ ├── PayAdmission.java │ │ │ │ └── PayRepository.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── navercorp │ │ │ └── spring │ │ │ └── data │ │ │ └── jdbc │ │ │ └── plus │ │ │ └── sql │ │ │ └── guide │ │ │ ├── ApplicationTest.java │ │ │ ├── board │ │ │ └── BoardRepositoryTest.java │ │ │ ├── order │ │ │ └── OrderRepositoryTest.java │ │ │ └── pay │ │ │ └── PayRepositoryTest.kt │ │ └── resources │ │ ├── application-test.yml │ │ └── data │ │ └── schema.sql └── plus-sql-kotlin-guide │ ├── build.gradle.kts │ └── src │ ├── main │ ├── kotlin │ │ └── com │ │ │ └── navercorp │ │ │ └── spring │ │ │ └── data │ │ │ └── jdbc │ │ │ └── plus │ │ │ └── sql │ │ │ └── guide │ │ │ ├── Application.kt │ │ │ ├── board │ │ │ ├── Board.kt │ │ │ ├── BoardRepository.kt │ │ │ ├── PostDto.kt │ │ │ └── sql │ │ │ │ └── BoardSql.kt │ │ │ ├── config │ │ │ └── JdbcConfiguration.kt │ │ │ └── order │ │ │ ├── Order.kt │ │ │ ├── OrderCriteria.kt │ │ │ ├── OrderRepository.kt │ │ │ └── sql │ │ │ └── OrderSql.kt │ └── resources │ │ └── application.yml │ └── test │ ├── kotlin │ └── com │ │ └── navercorp │ │ └── spring │ │ └── data │ │ └── jdbc │ │ └── plus │ │ └── sql │ │ └── guide │ │ ├── ApplicationTest.kt │ │ ├── board │ │ └── BoardRepositoryTest.kt │ │ └── order │ │ └── OrderRepositoryTest.kt │ └── resources │ ├── application-test.yml │ └── data │ └── schema.sql ├── rule ├── naver-checkstyle-rules.xml └── naver-intelllij-formatter.xml ├── settings.gradle ├── spring-boot-autoconfigure-data-jdbc-plus ├── build.gradle └── src │ └── main │ ├── java │ └── com │ │ └── navercorp │ │ └── spring │ │ └── boot │ │ └── autoconfigure │ │ └── data │ │ └── jdbc │ │ └── plus │ │ ├── aot │ │ └── JdbcPlusRuntimeHints.java │ │ ├── repository │ │ ├── JdbcPlusReactiveSupportRepositoriesRegistrar.java │ │ ├── JdbcPlusRepositoriesAutoConfiguration.java │ │ └── JdbcPlusRepositoriesRegistrar.java │ │ └── sql │ │ └── JdbcPlusSqlAutoConfiguration.java │ └── resources │ └── META-INF │ ├── additional-spring-configuration-metadata.json │ └── spring │ ├── aot.factories │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports ├── spring-boot-starter-data-jdbc-plus-repository ├── build.gradle └── src │ └── main │ ├── java │ └── com │ │ └── navercorp │ │ └── spring │ │ └── boot │ │ └── starter │ │ └── data │ │ └── jdbc │ │ └── plus │ │ └── repository │ │ └── JdbcPlusRepositoriesEnvironmentPostProcessor.java │ └── resources │ └── META-INF │ └── spring.factories ├── spring-boot-starter-data-jdbc-plus-sql └── build.gradle ├── spring-data-jdbc-plus-repository ├── build.gradle └── src │ └── main │ ├── java │ └── com │ │ └── navercorp │ │ └── spring │ │ └── data │ │ └── jdbc │ │ └── plus │ │ └── repository │ │ ├── JdbcRepository.java │ │ ├── config │ │ ├── AbstractJdbcPlusConfiguration.java │ │ ├── EnableJdbcPlusReactiveSupportRepositories.java │ │ ├── EnableJdbcPlusRepositories.java │ │ ├── JdbcPlusReactiveSupportRepositoriesRegistrar.java │ │ ├── JdbcPlusRepositoriesRegistrar.java │ │ ├── JdbcPlusRepositoryConfigExtension.java │ │ └── JdbcPlusRepositoryReactiveSupportConfigExtension.java │ │ └── support │ │ ├── JdbcPlusRepository.java │ │ ├── JdbcPlusRepositoryFactory.java │ │ └── JdbcPlusRepositoryFactoryBean.java │ └── resources │ └── META-INF │ └── spring.factories ├── spring-data-jdbc-plus-sql ├── build.gradle └── src │ ├── main │ └── java │ │ └── com │ │ └── navercorp │ │ └── spring │ │ └── data │ │ └── jdbc │ │ └── plus │ │ └── sql │ │ ├── config │ │ ├── EnableJdbcPlusSql.java │ │ └── JdbcPlusSqlConfiguration.java │ │ ├── convert │ │ ├── AggregateResultJdbcConverter.java │ │ ├── AggregateResultSetExtractor.java │ │ ├── JdbcBackReferencePropertyValueProvider.java │ │ ├── JdbcPropertyValueProvider.java │ │ ├── ResultMapPropertyAccessor.java │ │ └── ResultSetAccessor.java │ │ ├── parametersource │ │ ├── ConvertibleSqlIdentifierParameterSource.java │ │ ├── DefaultSqlParameterSourceFactory.java │ │ ├── EntityConvertibleSqlParameterSourceFactory.java │ │ ├── EntitySqlParameterSourceApplier.java │ │ └── SqlParameterSourceFactory.java │ │ ├── provider │ │ ├── EntityJdbcProvider.java │ │ ├── EntityQueryMappingConfiguration.java │ │ └── IllegalReturnTypeException.java │ │ └── support │ │ ├── JdbcDaoSupport.java │ │ ├── JdbcReactiveDaoSupport.java │ │ ├── JdbcRepositorySupport.java │ │ ├── SqlAware.java │ │ ├── SqlGeneratorSupport.java │ │ ├── template │ │ └── JdbcReactiveTemplate.java │ │ └── trait │ │ └── SingleValueSelectTrait.java │ └── test │ └── java │ └── com │ └── navercorp │ └── spring │ └── data │ └── jdbc │ └── plus │ └── sql │ └── provider │ └── EntityJdbcProviderTest.java ├── spring-data-jdbc-plus-support ├── build.gradle └── src │ ├── main │ └── java │ │ └── com │ │ └── navercorp │ │ └── spring │ │ └── data │ │ └── jdbc │ │ └── plus │ │ └── support │ │ ├── convert │ │ ├── DefaultSoftDeleteProperty.java │ │ ├── JdbcPlusDataAccessStrategy.java │ │ ├── JdbcPlusDataAccessStrategyFactory.java │ │ ├── PropertyPathUtils.java │ │ ├── SoftDeleteProperty.java │ │ ├── SqlContext.java │ │ ├── SqlContexts.java │ │ ├── SqlGenerator.java │ │ ├── SqlGeneratorSource.java │ │ ├── SqlProvider.java │ │ └── TableAliasUtils.java │ │ └── parametersource │ │ ├── BindParameterNameSanitizer.java │ │ ├── MutableSqlIdentifierParameterSource.java │ │ ├── SoftDeleteSqlParametersFactory.java │ │ └── SqlIdentifierParameterSource.java │ └── test │ └── java │ └── com │ └── navercorp │ └── spring │ └── data │ └── jdbc │ └── plus │ └── support │ └── convert │ ├── NonQuotingDialect.java │ ├── PersistentPropertyPathTestUtils.java │ ├── PropertyPathTestingUtils.java │ ├── SoftDeletePropertyTest.java │ ├── SqlGeneratorContextBasedNamingStrategyTest.java │ ├── SqlGeneratorEmbeddedTest.java │ ├── SqlGeneratorFixedNamingStrategyTest.java │ ├── SqlGeneratorTest.java │ └── SqlProviderTest.java ├── spring-data-plus-sql-gen ├── build.gradle └── src │ └── main │ ├── java │ └── com │ │ └── navercorp │ │ └── spring │ │ └── data │ │ └── plus │ │ └── sql │ │ └── gen │ │ ├── SpringDataTableGenerator.java │ │ ├── annotation │ │ └── GeneratedTable.java │ │ ├── column │ │ ├── TbColumn.java │ │ └── TbInfo.java │ │ └── dsl │ │ └── SqlDsl.java │ └── resources │ └── META-INF │ └── services │ └── javax.annotation.processing.Processor ├── spring-jdbc-plus-commons ├── build.gradle └── src │ └── main │ └── java │ └── com │ └── navercorp │ └── spring │ └── jdbc │ └── plus │ └── commons │ └── annotations │ ├── SoftDeleteColumn.java │ ├── SqlFunction.java │ └── SqlTableAlias.java └── spring-jdbc-plus-support ├── build.gradle └── src ├── main └── java │ └── com │ └── navercorp │ └── spring │ └── jdbc │ └── plus │ └── support │ └── parametersource │ ├── CompositeSqlParameterSource.java │ ├── ConvertibleBeanPropertySqlParameterSource.java │ ├── ConvertibleMapSqlParameterSource.java │ ├── ConvertibleParameterSourceFactory.java │ ├── converter │ ├── ConditionalConverter.java │ ├── ConditionalUnwrapper.java │ ├── DefaultJdbcParameterSourceConverter.java │ ├── EnumParameterTypeConverter.java │ ├── IterableExpandPadding.java │ ├── JdbcParameterSourceConverter.java │ ├── Jsr310TimestampBasedConverters.java │ ├── ParameterTypeConverterResolveException.java │ ├── Unwrapper.java │ ├── UuidParameterTypeConverter.java │ └── ValueMatcher.java │ └── fallback │ ├── FallbackParameterSource.java │ └── NoneFallbackParameterSource.java └── test └── java └── com └── navercorp └── spring └── jdbc └── plus └── support └── parametersource ├── ConvertibleBeanPropertySqlParameterSourceTest.java ├── ConvertibleMapSqlParameterSourceTest.java └── converter ├── DefaultJdbcParameterSourceConverterTest.java ├── EnumParameterTypeConverterTest.java ├── IterableExpandPaddingTest.java └── UuidParameterTypeConverterTest.java /.editorconfig: -------------------------------------------------------------------------------- 1 | # top-most EditorConfig file 2 | root = true 3 | 4 | [*.{kt, kts}] 5 | disabled_rules = import-ordering, indent 6 | # disable indent rule until https://github.com/pinterest/ktlint/issues/764 is fixed. 7 | 8 | [*] 9 | # [encoding-utf8] 10 | charset = utf-8 11 | 12 | # [newline-lf] 13 | end_of_line = lf 14 | 15 | # [newline-eof] 16 | insert_final_newline = true 17 | 18 | [*.bat] 19 | end_of_line = crlf 20 | 21 | [*.java] 22 | # [indentation-tab] 23 | indent_style = tab 24 | 25 | # [4-spaces-tab] 26 | indent_size = 4 27 | tab_width = 4 28 | 29 | # [no-trailing-spaces] 30 | trim_trailing_whitespace = true 31 | 32 | [line-length-120] 33 | max_line_length = 120 34 | -------------------------------------------------------------------------------- /.github/workflows/gradle.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Gradle 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle 3 | 4 | name: Check 5 | 6 | on: 7 | push: 8 | branches: [ main, 3.4.x, 3.3.x ] 9 | pull_request: 10 | branches: [ main, 3.4.x, 3.3.x ] 11 | 12 | jobs: 13 | check: 14 | name: Check 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Set up JDK 17 20 | uses: actions/setup-java@v3 21 | with: 22 | distribution: 'zulu' 23 | java-version: '17' 24 | cache: 'gradle' 25 | - name: Execute check 26 | uses: gradle/gradle-build-action@v2.4.2 27 | with: 28 | arguments: check 29 | 30 | - name: Publish test report 31 | uses: mikepenz/action-junit-report@v3.0.3 32 | if: always() # always run even if the previous step fails 33 | with: 34 | report_paths: '**/build/test-results/test/TEST-*.xml' 35 | github_token: ${{ secrets.GITHUB_TOKEN }} 36 | 37 | - name: Test Summary 38 | uses: test-summary/action@v1 39 | if: always() 40 | with: 41 | paths: '**/build/test-results/test/TEST-*.xml' 42 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish artifacts 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | tag: 7 | description: "Specify the tag, branch, or commit to target for the publish action" 8 | required: true 9 | default: 'default' 10 | type: string 11 | 12 | jobs: 13 | publish: 14 | name: Publish artifacts with Gradle 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - name: Checkout the repository 19 | uses: actions/checkout@v4 20 | with: 21 | ref: ${{ github.event.inputs.tag }} 22 | 23 | - name: Set up JDK 17 24 | uses: actions/setup-java@v3 25 | with: 26 | distribution: 'zulu' 27 | java-version: '17' 28 | 29 | - name: Verify source integrity 30 | run: ./gradlew clean build 31 | 32 | - name: Publish artifacts 33 | run: ./gradlew publish 34 | env: 35 | OSSRH_USERNAME: ${{ secrets.OSSRH_USER_NAME }} 36 | OSSRH_PASSWORD: ${{ secrets.OSSRH_USER_PASSWORD }} 37 | ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} 38 | ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build/ 3 | !gradle/wrapper/gradle-wrapper.jar 4 | /bin/ 5 | /env.bat 6 | 7 | generated 8 | 9 | ### STS ### 10 | .apt_generated 11 | .classpath 12 | .factorypath 13 | .project 14 | .settings 15 | .springBeans 16 | .sts4-cache 17 | 18 | ### IntelliJ IDEA ### 19 | .idea 20 | *.iws 21 | *.iml 22 | *.ipr 23 | out/ 24 | 25 | ### Mac OS ### 26 | .DS_Store 27 | -------------------------------------------------------------------------------- /buildSrc/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "groovy-gradle-plugin" 3 | } 4 | 5 | repositories { 6 | mavenLocal() 7 | mavenCentral() 8 | gradlePluginPortal() // give access to gradle community plugins 9 | maven { 10 | url "https://repo.spring.io/milestone/" 11 | } 12 | } 13 | 14 | dependencies { 15 | implementation "io.spring.gradle:dependency-management-plugin:1.1.5" 16 | } 17 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/spring.jdbc.plus.java-conventions.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "java-library" 3 | id "checkstyle" 4 | id "idea" 5 | } 6 | 7 | java { 8 | withJavadocJar() 9 | withSourcesJar() 10 | sourceCompatibility = JavaVersion.VERSION_17 11 | targetCompatibility = JavaVersion.VERSION_17 12 | } 13 | 14 | tasks.withType(Javadoc).configureEach { enabled = false } 15 | 16 | tasks.withType(JavaCompile).configureEach { 17 | options.compilerArgs << '-parameters' 18 | } 19 | 20 | test { 21 | useJUnitPlatform() 22 | } 23 | 24 | checkstyle { 25 | configFile = file("${project.rootDir}/rule/naver-checkstyle-rules.xml") 26 | configProperties = ["suppressionFile": "${project.rootDir}/rule/naver-checkstyle-suppressions.xml"] 27 | toolVersion = "10.16.0" 28 | ignoreFailures = false 29 | maxErrors = 0 30 | maxWarnings = 0 31 | } 32 | 33 | dependencies { 34 | compileOnly("com.google.code.findbugs:jsr305:3.0.2") 35 | testCompileOnly("com.google.code.findbugs:jsr305:3.0.2") 36 | } 37 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/spring.jdbc.plus.spring-bom-conventions.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "io.spring.dependency-management" 3 | } 4 | 5 | dependencyManagement { 6 | imports { 7 | mavenBom("org.springframework.boot:spring-boot-dependencies:${springBootVersion}") { 8 | bomProperties([ 9 | "spring-data-bom.version": "${springDataBomVersion}" 10 | ]) 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /doc/deployment_guide.md: -------------------------------------------------------------------------------- 1 | ## Deployment Guide 2 | 3 | ### Using GitHub Actions 4 | 5 | 1. Go to the "[Publish Artifacts](https://github.com/naver/spring-jdbc-plus/actions/workflows/publish.yml)" action. 6 | 2. Enter the tag, branch, or commit ID, and run the action. 7 | 3. You can verify the success of the deployment on [oss.sonatype.org](https://oss.sonatype.org/#stagingRepositories). 8 | 9 | ### Using a Local Machine 10 | 11 | 1. Set the following environment variables before publishing: 12 | - `ORG_GRADLE_PROJECT_signingKey`: Enter your personal GPG private key. Ensure that line breaks are removed, as shown [here](https://github.com/vanniktech/gradle-maven-publish-plugin/pull/201#discussion_r584270633). 13 | - `ORG_GRADLE_PROJECT_signingPassword`: Enter the password associated with your GPG private key. 14 | - `OSSRH_USERNAME`: Enter your OSSRH username using the generated [Access User Token](https://oss.sonatype.org/#profile;User%20Token). 15 | - `OSSRH_PASSWORD`: Enter your OSSRH password using the generated [Access User Token](https://oss.sonatype.org/#profile;User%20Token). 16 | 2. Run `./gradlew clean publish` to complete the publishing process. 17 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | springBootVersion=3.5.0-M1 2 | springDataBomVersion=2025.0.0-M1 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/naver/spring-jdbc-plus/e484a857ac8c144d0f89317ba8175a42cd9c95b2/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 08 13:12:22 KST 2020 2 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-all.zip 3 | distributionBase=GRADLE_USER_HOME 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "spring.jdbc.plus.java-conventions" 3 | id "spring.jdbc.plus.spring-bom-conventions" 4 | } 5 | 6 | dependencies { 7 | implementation project(':spring-boot-starter-data-jdbc-plus-repository') 8 | 9 | implementation("org.springframework.boot:spring-boot-starter-web") 10 | implementation("com.h2database:h2") 11 | implementation("org.projectlombok:lombok") 12 | annotationProcessor("org.projectlombok:lombok") 13 | 14 | implementation("org.springframework.data:spring-data-jdbc") 15 | implementation("org.springframework.data:spring-data-relational") 16 | implementation("org.springframework.data:spring-data-commons") 17 | 18 | testImplementation("org.springframework.boot:spring-boot-starter-test") 19 | testImplementation("org.projectlombok:lombok") 20 | testAnnotationProcessor("org.projectlombok:lombok") 21 | } 22 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2021 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.repository.guide; 20 | 21 | import org.springframework.boot.SpringApplication; 22 | import org.springframework.boot.autoconfigure.SpringBootApplication; 23 | import org.springframework.context.annotation.Bean; 24 | import org.springframework.context.annotation.Primary; 25 | import org.springframework.data.jdbc.core.dialect.JdbcMySqlDialect; 26 | import org.springframework.data.relational.core.dialect.Dialect; 27 | 28 | /** 29 | * @author Myeonghyeon Lee 30 | */ 31 | @SpringBootApplication 32 | public class Application { 33 | public static void main(String[] args) { 34 | SpringApplication.run(Application.class, args); 35 | } 36 | 37 | @Bean 38 | @Primary 39 | public Dialect mysqlDialect() { 40 | return JdbcMySqlDialect.INSTANCE; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/article/BooleanStateArticle.java: -------------------------------------------------------------------------------- 1 | package com.navercorp.spring.data.jdbc.plus.repository.guide.article; 2 | 3 | import java.time.Instant; 4 | 5 | import org.springframework.data.annotation.Id; 6 | import org.springframework.data.relational.core.mapping.Table; 7 | 8 | import lombok.AllArgsConstructor; 9 | import lombok.Builder; 10 | import lombok.Getter; 11 | 12 | import com.navercorp.spring.jdbc.plus.commons.annotations.SoftDeleteColumn; 13 | 14 | @Table("boolean_state_articles") 15 | @Getter 16 | @Builder(toBuilder = true) 17 | @AllArgsConstructor 18 | public class BooleanStateArticle { 19 | 20 | @Id 21 | private final Long id; 22 | private final String writerId; 23 | private final String contents; 24 | private final Instant createdAt; 25 | private final Instant lastModifiedAt; 26 | 27 | @SoftDeleteColumn.Boolean(valueAsDeleted = "false") 28 | private final boolean visible; 29 | } 30 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/article/BooleanStateArticleRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2024 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.repository.guide.article; 20 | 21 | import com.navercorp.spring.data.jdbc.plus.repository.JdbcRepository; 22 | import com.navercorp.spring.data.jdbc.plus.repository.guide.order.Order; 23 | 24 | /** 25 | * @author Chanhyeong Cho 26 | */ 27 | public interface BooleanStateArticleRepository extends JdbcRepository { 28 | } 29 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/article/EnumStateArticle.java: -------------------------------------------------------------------------------- 1 | package com.navercorp.spring.data.jdbc.plus.repository.guide.article; 2 | 3 | import java.time.Instant; 4 | 5 | import org.springframework.data.annotation.Id; 6 | import org.springframework.data.annotation.Version; 7 | import org.springframework.data.relational.core.mapping.Column; 8 | import org.springframework.data.relational.core.mapping.Table; 9 | 10 | import lombok.AllArgsConstructor; 11 | import lombok.Builder; 12 | import lombok.Getter; 13 | 14 | import com.navercorp.spring.jdbc.plus.commons.annotations.SoftDeleteColumn; 15 | 16 | @Table("enum_state_articles") 17 | @Getter 18 | @Builder(toBuilder = true) 19 | @AllArgsConstructor 20 | public class EnumStateArticle { 21 | 22 | @Id 23 | private final Long id; 24 | private final String writerId; 25 | private final String contents; 26 | private final Instant createdAt; 27 | private final Instant lastModifiedAt; 28 | 29 | @Version 30 | private final int version; 31 | 32 | @SoftDeleteColumn.String(valueAsDeleted = "CLOSE") 33 | @Column("article_state") 34 | private final State state; 35 | 36 | public boolean closed() { 37 | return state == State.CLOSE; 38 | } 39 | 40 | @Getter 41 | public enum State { 42 | OPEN("op"), CLOSE("cl"); 43 | 44 | private final String code; 45 | 46 | State(String code) { 47 | this.code = code; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/article/EnumStateArticleRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2024 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.repository.guide.article; 20 | 21 | import com.navercorp.spring.data.jdbc.plus.repository.JdbcRepository; 22 | 23 | /** 24 | * @author Chanhyeong Cho 25 | */ 26 | public interface EnumStateArticleRepository extends JdbcRepository { 27 | } 28 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/config/JdbcConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.navercorp.spring.data.jdbc.plus.repository.guide.config; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.core.convert.converter.Converter; 8 | import org.springframework.data.convert.ReadingConverter; 9 | import org.springframework.data.convert.WritingConverter; 10 | 11 | import com.navercorp.spring.data.jdbc.plus.repository.config.AbstractJdbcPlusConfiguration; 12 | import com.navercorp.spring.data.jdbc.plus.repository.guide.article.EnumStateArticle; 13 | import com.navercorp.spring.data.jdbc.plus.repository.guide.article.EnumStateArticle.State; 14 | 15 | @Configuration 16 | public class JdbcConfiguration extends AbstractJdbcPlusConfiguration { 17 | 18 | @Override 19 | protected List userConverters() { 20 | return List.of( 21 | new ArticleStateReadingConverter(), 22 | new ArticleStateWritingConverter() 23 | ); 24 | } 25 | 26 | @WritingConverter 27 | private static class ArticleStateWritingConverter implements Converter { 28 | @Override 29 | public String convert(EnumStateArticle.State source) { 30 | return source.getCode(); 31 | } 32 | } 33 | 34 | @ReadingConverter 35 | private static class ArticleStateReadingConverter implements Converter { 36 | @Override 37 | public State convert(String source) { 38 | return Arrays.stream(EnumStateArticle.State.values()) 39 | .filter(it -> it.getCode().equals(source)) 40 | .findFirst() 41 | .orElse(null); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/order/Order.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2021 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.repository.guide.order; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | import org.springframework.data.annotation.Id; 25 | import org.springframework.data.relational.core.mapping.Column; 26 | import org.springframework.data.relational.core.mapping.MappedCollection; 27 | import org.springframework.data.relational.core.mapping.Table; 28 | 29 | import lombok.AllArgsConstructor; 30 | import lombok.Builder; 31 | import lombok.Getter; 32 | import lombok.With; 33 | 34 | /** 35 | * @author Myeonghyeon Lee 36 | */ 37 | @Table("n_order") 38 | @Getter 39 | @Builder 40 | @AllArgsConstructor 41 | public final class Order { 42 | @Id 43 | @With 44 | private final Long id; 45 | private final String purchaserId; 46 | private OrderStatus status; 47 | @Column("order_id") 48 | private OrderDiscount discount; 49 | 50 | @MappedCollection(idColumn = "order_id", keyColumn = "idx") 51 | @Builder.Default 52 | private List items = new ArrayList<>(); 53 | 54 | public void complete() { 55 | this.status = OrderStatus.COMPLETED; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/order/OrderDiscount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2021 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.repository.guide.order; 20 | 21 | import java.math.BigDecimal; 22 | 23 | import org.springframework.data.annotation.Id; 24 | import org.springframework.data.relational.core.mapping.Table; 25 | 26 | import lombok.Builder; 27 | import lombok.Value; 28 | import lombok.With; 29 | 30 | /** 31 | * @author Myeonghyeon Lee 32 | */ 33 | @Table("n_order_discount") 34 | @Value 35 | @Builder 36 | public class OrderDiscount { 37 | @Id 38 | @With 39 | private Long id; 40 | 41 | private BigDecimal originPrice; 42 | 43 | private BigDecimal discountPrice; 44 | } 45 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/order/OrderItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2021 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.repository.guide.order; 20 | 21 | import org.springframework.data.annotation.Id; 22 | import org.springframework.data.relational.core.mapping.Embedded; 23 | import org.springframework.data.relational.core.mapping.Table; 24 | 25 | import lombok.AllArgsConstructor; 26 | import lombok.Builder; 27 | import lombok.Value; 28 | import lombok.With; 29 | 30 | /** 31 | * @author Myeonghyeon Lee 32 | */ 33 | @Table("n_order_item") 34 | @Value 35 | @Builder 36 | @AllArgsConstructor 37 | public class OrderItem { 38 | @Id 39 | @With 40 | private Long id; 41 | 42 | private String productNo; 43 | 44 | private String name; 45 | 46 | @Embedded.Nullable 47 | private Pricing pricing; 48 | 49 | private final String sellerId; 50 | } 51 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/order/OrderRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2021 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.repository.guide.order; 20 | 21 | import com.navercorp.spring.data.jdbc.plus.repository.JdbcRepository; 22 | 23 | /** 24 | * @author Myeonghyeon Lee 25 | */ 26 | public interface OrderRepository extends JdbcRepository { 27 | } 28 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/order/OrderStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2021 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.repository.guide.order; 20 | 21 | /** 22 | * @author Myeonghyeon Lee 23 | */ 24 | public enum OrderStatus { 25 | PLACE, COMPLETED 26 | } 27 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/order/Pricing.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2021 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.repository.guide.order; 20 | 21 | import java.math.BigDecimal; 22 | import java.util.Objects; 23 | 24 | import lombok.Builder; 25 | import lombok.Value; 26 | 27 | /** 28 | * @author Myeonghyeon Lee 29 | */ 30 | @Value 31 | @Builder 32 | public final class Pricing { 33 | private final long quantity; 34 | 35 | @Builder.Default 36 | private final BigDecimal price = BigDecimal.ZERO; 37 | 38 | public Pricing add(Pricing pricing) { 39 | return Pricing.builder() 40 | .quantity(this.quantity + pricing.getQuantity()) 41 | .price(this.price.add(pricing.getPrice())) 42 | .build(); 43 | } 44 | 45 | @Override 46 | public boolean equals(Object obj) { 47 | if (this == obj) { 48 | return true; 49 | } 50 | if (obj == null || getClass() != obj.getClass()) { 51 | return false; 52 | } 53 | 54 | Pricing pricing = (Pricing)obj; 55 | return Objects.equals(quantity, pricing.quantity) 56 | && Objects.equals(price.stripTrailingZeros(), pricing.price.stripTrailingZeros()); 57 | } 58 | 59 | @Override 60 | public int hashCode() { 61 | return Objects.hash(quantity, price.stripTrailingZeros()); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/product/PlainProduct.java: -------------------------------------------------------------------------------- 1 | package com.navercorp.spring.data.jdbc.plus.repository.guide.product; 2 | 3 | import java.time.Instant; 4 | 5 | import org.springframework.data.annotation.Id; 6 | import org.springframework.data.relational.core.mapping.Table; 7 | 8 | import lombok.AllArgsConstructor; 9 | import lombok.Builder; 10 | import lombok.Getter; 11 | 12 | @Table("plain_products") 13 | @Getter 14 | @Builder(toBuilder = true) 15 | @AllArgsConstructor 16 | public class PlainProduct { 17 | 18 | @Id 19 | private final Long id; 20 | private final String productName; 21 | private final Instant createdAt; 22 | private final Instant lastModifiedAt; 23 | } 24 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/product/PlainProductRepository.java: -------------------------------------------------------------------------------- 1 | package com.navercorp.spring.data.jdbc.plus.repository.guide.product; 2 | 3 | import com.navercorp.spring.data.jdbc.plus.repository.JdbcRepository; 4 | 5 | public interface PlainProductRepository extends JdbcRepository { 6 | } 7 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/product/PlainProductWithSoftDeleteReview.java: -------------------------------------------------------------------------------- 1 | package com.navercorp.spring.data.jdbc.plus.repository.guide.product; 2 | 3 | import java.time.Instant; 4 | import java.util.Set; 5 | 6 | import org.springframework.data.annotation.Id; 7 | import org.springframework.data.relational.core.mapping.MappedCollection; 8 | import org.springframework.data.relational.core.mapping.Table; 9 | 10 | import lombok.AllArgsConstructor; 11 | import lombok.Builder; 12 | import lombok.Getter; 13 | 14 | @Table("plain_products") 15 | @Getter 16 | @Builder(toBuilder = true) 17 | @AllArgsConstructor 18 | public class PlainProductWithSoftDeleteReview { 19 | 20 | @Id 21 | private final Long id; 22 | private final String productName; 23 | private final Instant createdAt; 24 | private final Instant lastModifiedAt; 25 | 26 | @MappedCollection(idColumn = "product_id") 27 | private final Set reviews; 28 | } 29 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/product/PlainProductWithSoftDeleteReviewRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2024 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.repository.guide.product; 20 | 21 | import com.navercorp.spring.data.jdbc.plus.repository.JdbcRepository; 22 | 23 | /** 24 | * @author Chanhyeong Cho 25 | */ 26 | public interface PlainProductWithSoftDeleteReviewRepository 27 | extends JdbcRepository { 28 | } 29 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/product/PlainReview.java: -------------------------------------------------------------------------------- 1 | package com.navercorp.spring.data.jdbc.plus.repository.guide.product; 2 | 3 | import java.time.Instant; 4 | 5 | import org.springframework.data.annotation.Id; 6 | import org.springframework.data.relational.core.mapping.Table; 7 | 8 | import lombok.AllArgsConstructor; 9 | import lombok.Builder; 10 | import lombok.Getter; 11 | 12 | @Table("plain_reviews") 13 | @Getter 14 | @Builder(toBuilder = true) 15 | @AllArgsConstructor 16 | public class PlainReview { 17 | 18 | @Id 19 | private final Long id; 20 | private final Long productId; 21 | private final String contents; 22 | private final Instant createdAt; 23 | private final Instant lastModifiedAt; 24 | } 25 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/product/SoftDeleteProduct.java: -------------------------------------------------------------------------------- 1 | package com.navercorp.spring.data.jdbc.plus.repository.guide.product; 2 | 3 | import java.time.Instant; 4 | import java.util.Set; 5 | 6 | import org.springframework.data.annotation.Id; 7 | import org.springframework.data.relational.core.mapping.MappedCollection; 8 | import org.springframework.data.relational.core.mapping.Table; 9 | 10 | import lombok.AllArgsConstructor; 11 | import lombok.Builder; 12 | import lombok.Getter; 13 | 14 | import com.navercorp.spring.jdbc.plus.commons.annotations.SoftDeleteColumn; 15 | 16 | @Table("soft_delete_products") 17 | @Getter 18 | @Builder(toBuilder = true) 19 | @AllArgsConstructor 20 | public class SoftDeleteProduct { 21 | 22 | @Id 23 | private final Long id; 24 | private final String productName; 25 | private final Instant createdAt; 26 | private final Instant lastModifiedAt; 27 | 28 | @MappedCollection(idColumn = "product_id") 29 | private final Set reviews; 30 | 31 | @SoftDeleteColumn.Boolean(valueAsDeleted = "false") 32 | private final boolean visible; 33 | } 34 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/product/SoftDeleteProductRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2024 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.repository.guide.product; 20 | 21 | import com.navercorp.spring.data.jdbc.plus.repository.JdbcRepository; 22 | 23 | /** 24 | * @author Chanhyeong Cho 25 | */ 26 | public interface SoftDeleteProductRepository extends JdbcRepository { 27 | } 28 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/product/SoftDeleteProductWithPlainReview.java: -------------------------------------------------------------------------------- 1 | package com.navercorp.spring.data.jdbc.plus.repository.guide.product; 2 | 3 | import java.time.Instant; 4 | import java.util.Set; 5 | 6 | import org.springframework.data.annotation.Id; 7 | import org.springframework.data.relational.core.mapping.MappedCollection; 8 | import org.springframework.data.relational.core.mapping.Table; 9 | 10 | import lombok.AllArgsConstructor; 11 | import lombok.Builder; 12 | import lombok.Getter; 13 | 14 | import com.navercorp.spring.jdbc.plus.commons.annotations.SoftDeleteColumn; 15 | 16 | @Table("soft_delete_products") 17 | @Getter 18 | @Builder(toBuilder = true) 19 | @AllArgsConstructor 20 | public class SoftDeleteProductWithPlainReview { 21 | 22 | @Id 23 | private final Long id; 24 | private final String productName; 25 | private final Instant createdAt; 26 | private final Instant lastModifiedAt; 27 | 28 | @MappedCollection(idColumn = "product_id") 29 | private final Set reviews; 30 | 31 | @SoftDeleteColumn.Boolean(valueAsDeleted = "false") 32 | private final boolean visible; 33 | } 34 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/product/SoftDeleteProductWithPlainReviewRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2024 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.repository.guide.product; 20 | 21 | import com.navercorp.spring.data.jdbc.plus.repository.JdbcRepository; 22 | 23 | /** 24 | * @author Chanhyeong Cho 25 | */ 26 | public interface SoftDeleteProductWithPlainReviewRepository 27 | extends JdbcRepository { 28 | } 29 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/product/SoftDeleteReview.java: -------------------------------------------------------------------------------- 1 | package com.navercorp.spring.data.jdbc.plus.repository.guide.product; 2 | 3 | import java.time.Instant; 4 | 5 | import org.springframework.data.annotation.Id; 6 | import org.springframework.data.relational.core.mapping.Table; 7 | 8 | import lombok.AllArgsConstructor; 9 | import lombok.Builder; 10 | import lombok.Getter; 11 | 12 | import com.navercorp.spring.jdbc.plus.commons.annotations.SoftDeleteColumn; 13 | 14 | @Table("soft_delete_reviews") 15 | @Getter 16 | @Builder(toBuilder = true) 17 | @AllArgsConstructor 18 | public class SoftDeleteReview { 19 | 20 | @Id 21 | private final Long id; 22 | private final Long productId; 23 | private final String contents; 24 | private final Instant createdAt; 25 | private final Instant lastModifiedAt; 26 | 27 | @SoftDeleteColumn.Boolean(valueAsDeleted = "false") 28 | private final boolean visible; 29 | } 30 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/product/SoftDeleteReviewRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2024 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.repository.guide.product; 20 | 21 | import java.util.List; 22 | 23 | import com.navercorp.spring.data.jdbc.plus.repository.JdbcRepository; 24 | 25 | /** 26 | * @author Chanhyeong Cho 27 | */ 28 | public interface SoftDeleteReviewRepository extends JdbcRepository { 29 | 30 | List findAllByProductIdIn(List productIds); 31 | } 32 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/shipping/Shipping.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2021 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.repository.guide.shipping; 20 | 21 | import java.util.UUID; 22 | 23 | import org.springframework.data.annotation.Id; 24 | import org.springframework.data.jdbc.core.mapping.AggregateReference; 25 | import org.springframework.data.relational.core.mapping.Table; 26 | 27 | import lombok.AllArgsConstructor; 28 | import lombok.Builder; 29 | import lombok.Getter; 30 | import lombok.With; 31 | 32 | import com.navercorp.spring.data.jdbc.plus.repository.guide.order.Order; 33 | 34 | /** 35 | * @author Myeonghyeon Lee 36 | */ 37 | @Table("n_shipping") 38 | @Getter 39 | @Builder 40 | @AllArgsConstructor 41 | public class Shipping { 42 | @Id 43 | @With 44 | private final UUID id; 45 | 46 | private final AggregateReference orderId; 47 | 48 | private String receiverAddress; 49 | 50 | private String memo; 51 | 52 | public void changeMemo(String memo) { 53 | this.memo = memo; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/guide/shipping/ShippingRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2021 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.repository.guide.shipping; 20 | 21 | import java.util.Optional; 22 | import java.util.UUID; 23 | 24 | import org.springframework.data.jdbc.core.mapping.AggregateReference; 25 | 26 | import com.navercorp.spring.data.jdbc.plus.repository.JdbcRepository; 27 | import com.navercorp.spring.data.jdbc.plus.repository.guide.order.Order; 28 | 29 | /** 30 | * @author Myeonghyeon Lee 31 | */ 32 | public interface ShippingRepository extends JdbcRepository { 33 | Optional findByOrderId(AggregateReference order); 34 | } 35 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | hikari: 4 | url: jdbc:h2:mem:test;MODE=MySQL;IGNORECASE=TRUE 5 | driver-class-name: org.h2.Driver 6 | 7 | logging: 8 | level: 9 | org.springframework.jdbc.core: TRACE 10 | org.springframework.jdbc.core.StatementCreatorUtils: TRACE 11 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/test/java/com/navercorp/spring/data/jdbc/plus/repository/guide/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2021 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.repository.guide; 20 | 21 | import org.junit.jupiter.api.Test; 22 | import org.springframework.boot.test.context.SpringBootTest; 23 | 24 | /** 25 | * @author Myeonghyeon Lee 26 | */ 27 | @SpringBootTest 28 | class ApplicationTest { 29 | @Test 30 | void contextLoads() { 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/test/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | sql: 3 | init: 4 | schema-locations: classpath:data/schema.sql 5 | encoding: UTF-8 6 | -------------------------------------------------------------------------------- /guide-projects/plus-repository-guide/src/test/resources/data/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS n_order ( 2 | id INT AUTO_INCREMENT, 3 | status VARCHAR(20), 4 | purchaser_id VARCHAR(36), 5 | PRIMARY KEY(id)); 6 | 7 | CREATE TABLE IF NOT EXISTS n_order_discount ( 8 | id INT AUTO_INCREMENT, 9 | order_id INT, 10 | origin_price DOUBLE, 11 | discount_price DOUBLE, 12 | PRIMARY KEY(id)); 13 | 14 | CREATE TABLE IF NOT EXISTS n_order_item ( 15 | id INT AUTO_INCREMENT, 16 | order_id INT, 17 | product_no VARCHAR(36), 18 | name VARCHAR(200), 19 | quantity BIGINT, 20 | price DOUBLE, 21 | seller_id VARCHAR(36), 22 | idx INTEGER, 23 | PRIMARY KEY(id)); 24 | 25 | CREATE TABLE IF NOT EXISTS n_shipping ( 26 | id VARCHAR(36), 27 | order_id INT, 28 | receiver_address VARCHAR(255), 29 | memo VARCHAR(255), 30 | PRIMARY KEY(id)); 31 | 32 | CREATE TABLE IF NOT EXISTS boolean_state_articles ( 33 | id BIGINT AUTO_INCREMENT, 34 | writer_id VARCHAR(20), 35 | contents TEXT, 36 | created_at DATETIME, 37 | last_modified_at DATETIME, 38 | visible TINYINT, 39 | PRIMARY KEY(id)); 40 | 41 | CREATE TABLE IF NOT EXISTS enum_state_articles ( 42 | id BIGINT AUTO_INCREMENT, 43 | writer_id VARCHAR(20), 44 | contents TEXT, 45 | created_at DATETIME, 46 | last_modified_at DATETIME, 47 | version INT, 48 | article_state VARCHAR(2), 49 | PRIMARY KEY(id)); 50 | 51 | CREATE TABLE IF NOT EXISTS soft_delete_products ( 52 | id BIGINT AUTO_INCREMENT, 53 | product_name VARCHAR(20), 54 | created_at DATETIME, 55 | last_modified_at DATETIME, 56 | visible TINYINT, 57 | PRIMARY KEY(id)); 58 | 59 | CREATE TABLE IF NOT EXISTS soft_delete_reviews ( 60 | id BIGINT AUTO_INCREMENT, 61 | product_id BIGINT, 62 | contents TEXT, 63 | created_at DATETIME, 64 | last_modified_at DATETIME, 65 | visible TINYINT, 66 | PRIMARY KEY(id)); 67 | 68 | CREATE TABLE IF NOT EXISTS plain_products ( 69 | id BIGINT AUTO_INCREMENT, 70 | product_name VARCHAR(20), 71 | created_at DATETIME, 72 | last_modified_at DATETIME, 73 | PRIMARY KEY(id)); 74 | 75 | CREATE TABLE IF NOT EXISTS plain_reviews ( 76 | id BIGINT AUTO_INCREMENT, 77 | product_id BIGINT, 78 | contents TEXT, 79 | created_at DATETIME, 80 | last_modified_at DATETIME, 81 | visible TINYINT, 82 | PRIMARY KEY(id)); 83 | -------------------------------------------------------------------------------- /guide-projects/plus-sql-java-groovy-guide/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "spring.jdbc.plus.java-conventions" 3 | id "spring.jdbc.plus.spring-bom-conventions" 4 | id "groovy" 5 | } 6 | 7 | compileGroovy { 8 | options.encoding = "UTF-8" 9 | groovyOptions.encoding = "UTF-8" 10 | } 11 | 12 | if (project.convention.findPlugin(JavaPluginConvention)) { 13 | // Change the output directory for the main and test source sets back to the old path 14 | sourceSets.main.java.destinationDirectory = new File(buildDir, "classes/main") 15 | sourceSets.main.groovy.destinationDirectory = new File(buildDir, "classes/main") 16 | sourceSets.test.java.destinationDirectory = new File(buildDir, "classes/test") 17 | sourceSets.test.groovy.destinationDirectory = new File(buildDir, "classes/test") 18 | } 19 | 20 | tasks.withType(GroovyCompile).configureEach { 21 | dependsOn = [] 22 | options.compilerArgs << '-parameters' 23 | options.generatedSourceOutputDirectory = project.file("src/main/generated") 24 | } 25 | 26 | sourceSets { 27 | main { 28 | java { srcDirs = [] } 29 | groovy { srcDirs += ["src/main/java"] } 30 | } 31 | } 32 | 33 | dependencies { 34 | implementation("org.springframework.boot:spring-boot-starter-web") 35 | implementation project(":spring-boot-starter-data-jdbc-plus-sql") 36 | implementation("org.springframework.boot:spring-boot-starter-actuator") 37 | implementation('org.codehaus.groovy:groovy:3.0.23') 38 | implementation("com.h2database:h2") 39 | 40 | implementation("org.springframework.data:spring-data-jdbc") 41 | implementation("org.springframework.data:spring-data-relational") 42 | implementation("org.springframework.data:spring-data-commons") 43 | 44 | implementation project(":spring-data-plus-sql-gen") 45 | annotationProcessor project(":spring-data-plus-sql-gen") 46 | annotationProcessor("org.springframework.data:spring-data-jdbc") 47 | annotationProcessor("org.springframework.data:spring-data-relational") 48 | annotationProcessor("org.springframework.data:spring-data-commons") 49 | 50 | compileOnly("org.projectlombok:lombok") 51 | annotationProcessor("org.projectlombok:lombok") 52 | 53 | testImplementation("org.springframework.boot:spring-boot-starter-test") 54 | testCompileOnly("org.projectlombok:lombok") 55 | testAnnotationProcessor("org.projectlombok:lombok") 56 | } 57 | -------------------------------------------------------------------------------- /guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2021 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.sql.guide; 20 | 21 | import org.springframework.boot.SpringApplication; 22 | import org.springframework.boot.autoconfigure.SpringBootApplication; 23 | import org.springframework.context.annotation.Bean; 24 | import org.springframework.context.annotation.Primary; 25 | import org.springframework.data.jdbc.core.dialect.JdbcMySqlDialect; 26 | import org.springframework.data.relational.core.dialect.Dialect; 27 | 28 | /** 29 | * @author Myeonghyeon Lee 30 | */ 31 | @SpringBootApplication 32 | public class Application { 33 | public static void main(String[] args) { 34 | SpringApplication.run(Application.class, args); 35 | } 36 | 37 | @Bean 38 | @Primary 39 | public Dialect mysqlDialect() { 40 | return JdbcMySqlDialect.INSTANCE; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/BoardRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2021 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.sql.guide.board; 20 | 21 | import org.springframework.data.repository.CrudRepository; 22 | 23 | /** 24 | * @author Myeonghyeon Lee 25 | */ 26 | public interface BoardRepository extends CrudRepository, BoardRepositoryCustom { 27 | } 28 | -------------------------------------------------------------------------------- /guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/BoardRepositoryCustom.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2021 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.sql.guide.board; 20 | 21 | import java.util.List; 22 | import java.util.Optional; 23 | 24 | /** 25 | * @author Myeonghyeon Lee 26 | */ 27 | public interface BoardRepositoryCustom { 28 | Optional findGraphById(Long id); 29 | 30 | List findAllGraph(); 31 | 32 | Optional findPostDtoByPostId(Long postId); 33 | } 34 | -------------------------------------------------------------------------------- /guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/BoardRepositoryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2021 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.sql.guide.board; 20 | 21 | import java.util.List; 22 | import java.util.Optional; 23 | 24 | import com.navercorp.spring.data.jdbc.plus.sql.guide.board.sql.BoardSql; 25 | import com.navercorp.spring.data.jdbc.plus.sql.provider.EntityJdbcProvider; 26 | import com.navercorp.spring.data.jdbc.plus.sql.support.JdbcRepositorySupport; 27 | 28 | /** 29 | * @author Myeonghyeon Lee 30 | */ 31 | public class BoardRepositoryImpl extends JdbcRepositorySupport implements BoardRepositoryCustom { 32 | private final BoardSql sqls; 33 | 34 | protected BoardRepositoryImpl(EntityJdbcProvider entityJdbcProvider) { 35 | super(Board.class, entityJdbcProvider); 36 | this.sqls = sqls(BoardSql::new); 37 | } 38 | 39 | @Override 40 | public Optional findGraphById(Long id) { 41 | return findOne(this.sqls.selectGraphById(), mapParameterSource() 42 | .addValue("boardId", id)); 43 | } 44 | 45 | @Override 46 | public List findAllGraph() { 47 | return find(this.sqls.selectAllGraph(), mapParameterSource()); 48 | } 49 | 50 | @Override 51 | public Optional findPostDtoByPostId(Long postId) { 52 | return findOne(this.sqls.selectPostDtoByPostId(), mapParameterSource() 53 | .addValue("postId", postId), 54 | PostDto.class); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /guide-projects/plus-sql-java-groovy-guide/src/main/java/com/navercorp/spring/data/jdbc/plus/sql/guide/board/PostDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Spring JDBC Plus 3 | * 4 | * Copyright 2020-2021 NAVER Corp. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.navercorp.spring.data.jdbc.plus.sql.guide.board; 20 | 21 | import java.util.Set; 22 | 23 | import org.springframework.data.annotation.Id; 24 | import org.springframework.data.relational.core.mapping.Column; 25 | import org.springframework.data.relational.core.mapping.MappedCollection; 26 | import org.springframework.data.relational.core.mapping.Table; 27 | 28 | import lombok.Builder; 29 | import lombok.Value; 30 | 31 | import com.navercorp.spring.data.jdbc.plus.sql.guide.board.Board.Label; 32 | import com.navercorp.spring.data.jdbc.plus.sql.guide.board.Board.Post; 33 | import com.navercorp.spring.jdbc.plus.commons.annotations.SqlTableAlias; 34 | 35 | /** 36 | * @author Myeonghyeon Lee 37 | */ 38 | @Value 39 | @Builder 40 | @Table("post") 41 | public class PostDto { 42 | @Id 43 | Long id; 44 | 45 | @Column 46 | Post post; 47 | 48 | @SqlTableAlias("p_labels") 49 | @MappedCollection(idColumn = "board_id") 50 | Set