From ea32a179fec6b227a7098c77ea1df1ab638df5ba Mon Sep 17 00:00:00 2001 From: kyubeom Date: Sun, 18 Aug 2024 21:13:21 +0900 Subject: [PATCH] =?UTF-8?q?#1=20jpa=20=EB=AA=A8=EB=93=88=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/build.gradle.kts | 13 +++++++++--- .../main/kotlin/com/core/CoreApplication.kt | 3 +-- .../core/adapter/in/web/dto/AdapterMealDto.kt | 2 +- .../out/persistence/MealPersistenceAdapter.kt | 19 ------------------ .../domain/meal/service/MealReadService.kt | 11 +++++----- .../application/port/in/GetWeekMealUseCase.kt | 3 ++- .../application/port/out/GetWeekMealPort.kt | 11 ---------- core/src/main/resources/application.yml | 13 +++--------- .../com/jpa/domain/MealPersistenceAdapter.kt | 19 ++++++++++++++++++ .../com/jpa/domain}/common/BaseEntity.kt | 2 +- .../com/jpa/domain}/entity/CampusJpaEntity.kt | 4 ++-- .../com/jpa/domain}/entity/MealJpaEntity.kt | 10 ++++------ .../jpa/domain}/entity/RestaurantJpaEntity.kt | 4 ++-- .../com/jpa/domain}/entity/ScrapJpaEntity.kt | 2 +- .../com/jpa/domain}/entity/StoreJpaEntity.kt | 2 +- .../com/jpa/domain}/entity/UserJpaEntity.kt | 2 +- .../com/jpa/domain}/enumerate/MealStatus.kt | 2 +- .../com/jpa/domain}/enumerate/MealType.kt | 2 +- .../com/jpa/domain/global/config/JpaConfig.kt | 11 ++++++++++ .../com/jpa/domain}/mapper/MealMapper.kt | 10 +++++----- .../kotlin/com/jpa/domain}/model/Campus.kt | 2 +- .../main/kotlin/com/jpa/domain}/model/Meal.kt | 6 +++--- .../com/jpa/domain}/model/Restaurant.kt | 2 +- .../jpa/domain}/repository/MealRepository.kt | 5 ++--- jpa/src/main/resources/application-jpa.yml | 20 +++++++++++++++++++ settings.gradle.kts | 3 ++- 26 files changed, 100 insertions(+), 83 deletions(-) delete mode 100644 core/src/main/kotlin/com/core/adapter/out/persistence/MealPersistenceAdapter.kt delete mode 100644 core/src/main/kotlin/com/core/application/port/out/GetWeekMealPort.kt create mode 100644 jpa/src/main/kotlin/com/jpa/domain/MealPersistenceAdapter.kt rename {core/src/main/kotlin/com/core => jpa/src/main/kotlin/com/jpa/domain}/common/BaseEntity.kt (95%) rename {core/src/main/kotlin/com/core/adapter/out/persistence => jpa/src/main/kotlin/com/jpa/domain}/entity/CampusJpaEntity.kt (84%) rename {core/src/main/kotlin/com/core/adapter/out/persistence => jpa/src/main/kotlin/com/jpa/domain}/entity/MealJpaEntity.kt (78%) rename {core/src/main/kotlin/com/core/adapter/out/persistence => jpa/src/main/kotlin/com/jpa/domain}/entity/RestaurantJpaEntity.kt (87%) rename {core/src/main/kotlin/com/core/adapter/out/persistence => jpa/src/main/kotlin/com/jpa/domain}/entity/ScrapJpaEntity.kt (87%) rename {core/src/main/kotlin/com/core/adapter/out/persistence => jpa/src/main/kotlin/com/jpa/domain}/entity/StoreJpaEntity.kt (97%) rename {core/src/main/kotlin/com/core/adapter/out/persistence => jpa/src/main/kotlin/com/jpa/domain}/entity/UserJpaEntity.kt (83%) rename {core/src/main/kotlin/com/core/adapter/out/persistence => jpa/src/main/kotlin/com/jpa/domain}/enumerate/MealStatus.kt (76%) rename {core/src/main/kotlin/com/core/adapter/out/persistence => jpa/src/main/kotlin/com/jpa/domain}/enumerate/MealType.kt (72%) create mode 100644 jpa/src/main/kotlin/com/jpa/domain/global/config/JpaConfig.kt rename {core/src/main/kotlin/com/core/adapter/out/persistence => jpa/src/main/kotlin/com/jpa/domain}/mapper/MealMapper.kt (80%) rename {core/src/main/kotlin/com/core/application/domain/meal => jpa/src/main/kotlin/com/jpa/domain}/model/Campus.kt (86%) rename {core/src/main/kotlin/com/core/application/domain/meal => jpa/src/main/kotlin/com/jpa/domain}/model/Meal.kt (77%) rename {core/src/main/kotlin/com/core/application/domain/meal => jpa/src/main/kotlin/com/jpa/domain}/model/Restaurant.kt (88%) rename {core/src/main/kotlin/com/core/adapter/out/persistence => jpa/src/main/kotlin/com/jpa/domain}/repository/MealRepository.kt (79%) create mode 100644 jpa/src/main/resources/application-jpa.yml diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 7bf23a0..3a9ed1f 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -2,11 +2,18 @@ plugins { idea } - dependencies { + implementation(project(":jpa")) + implementation("org.springframework.boot:spring-boot-starter-data-jpa") - //mysql - implementation("mysql:mysql-connector-java:8.0.33") //swagger implementation ("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2") } + +tasks.register("prepareKotlinBuildScriptModel") {} + +configurations { + compileOnly { + extendsFrom(configurations.annotationProcessor.get()) + } +} diff --git a/core/src/main/kotlin/com/core/CoreApplication.kt b/core/src/main/kotlin/com/core/CoreApplication.kt index dd7ed78..89aaa2b 100644 --- a/core/src/main/kotlin/com/core/CoreApplication.kt +++ b/core/src/main/kotlin/com/core/CoreApplication.kt @@ -3,9 +3,8 @@ package com.core import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.runApplication -@SpringBootApplication +@SpringBootApplication(scanBasePackages = ["com.core", "com.jpa"]) class CoreApplication - fun main(args: Array) { runApplication(*args) } \ No newline at end of file diff --git a/core/src/main/kotlin/com/core/adapter/in/web/dto/AdapterMealDto.kt b/core/src/main/kotlin/com/core/adapter/in/web/dto/AdapterMealDto.kt index b44d85b..1ecf269 100644 --- a/core/src/main/kotlin/com/core/adapter/in/web/dto/AdapterMealDto.kt +++ b/core/src/main/kotlin/com/core/adapter/in/web/dto/AdapterMealDto.kt @@ -1,6 +1,6 @@ package com.core.adapter.`in`.web.dto -import com.core.application.domain.meal.model.Meal +import com.jpa.domain.model.Meal import java.math.BigDecimal import java.time.LocalDate diff --git a/core/src/main/kotlin/com/core/adapter/out/persistence/MealPersistenceAdapter.kt b/core/src/main/kotlin/com/core/adapter/out/persistence/MealPersistenceAdapter.kt deleted file mode 100644 index 6449ca6..0000000 --- a/core/src/main/kotlin/com/core/adapter/out/persistence/MealPersistenceAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.core.adapter.out.persistence - -import com.core.adapter.out.persistence.mapper.MealMapper -import com.core.adapter.out.persistence.repository.MealRepository -import com.core.application.domain.meal.model.Meal -import com.core.application.port.out.GetWeekMealPort -import org.springframework.stereotype.Component -import java.time.LocalDate - -@Component class MealPersistenceAdapter( - private val mealRepository: MealRepository, - private val mealMapper: MealMapper -) : GetWeekMealPort { - override fun invoke(restaurantIdx: Long, start: LocalDate, end: LocalDate): List { - val weekMeal = mealRepository.getWeekMeal(restaurantIdx, start, end) - val applicationMeals = mealMapper.toDomain(weekMeal); - return applicationMeals - } -} \ No newline at end of file diff --git a/core/src/main/kotlin/com/core/application/domain/meal/service/MealReadService.kt b/core/src/main/kotlin/com/core/application/domain/meal/service/MealReadService.kt index 6cf6273..e271a09 100644 --- a/core/src/main/kotlin/com/core/application/domain/meal/service/MealReadService.kt +++ b/core/src/main/kotlin/com/core/application/domain/meal/service/MealReadService.kt @@ -1,15 +1,15 @@ package com.core.application.domain.meal.service -import com.core.application.domain.meal.model.Meal import com.core.application.port.`in`.GetWeekMealUseCase -import com.core.application.port.out.GetWeekMealPort +import com.jpa.domain.MealPersistenceAdapter +import com.jpa.domain.model.Meal import org.springframework.stereotype.Service import java.time.DayOfWeek import java.time.LocalDate @Service class MealReadService( - private val getWeekMealPort: GetWeekMealPort + private val mealPersistenceAdapter: MealPersistenceAdapter ) : GetWeekMealUseCase { /** @@ -17,9 +17,9 @@ class MealReadService( * @param restaurantName * @return List */ - override fun invoke(restaurantIdx: Long): List { + override operator fun invoke(restaurantIdx: Long): List { val (startDay, endDay) = getWeekRange() - val meals = getWeekMealPort(restaurantIdx, startDay, endDay) + val meals = mealPersistenceAdapter.getWeekMeals(restaurantIdx, startDay, endDay) return meals } @@ -31,7 +31,6 @@ class MealReadService( val today = LocalDate.now() val startOfWeek = today.minusDays((today.dayOfWeek.value % 7).toLong()).with(DayOfWeek.SUNDAY) val endOfWeek = startOfWeek.plusDays(6) - return Pair(startOfWeek, endOfWeek) } diff --git a/core/src/main/kotlin/com/core/application/port/in/GetWeekMealUseCase.kt b/core/src/main/kotlin/com/core/application/port/in/GetWeekMealUseCase.kt index 79dcd88..af9a976 100644 --- a/core/src/main/kotlin/com/core/application/port/in/GetWeekMealUseCase.kt +++ b/core/src/main/kotlin/com/core/application/port/in/GetWeekMealUseCase.kt @@ -1,6 +1,7 @@ package com.core.application.port.`in` -import com.core.application.domain.meal.model.Meal +import com.jpa.domain.model.Meal + interface GetWeekMealUseCase { diff --git a/core/src/main/kotlin/com/core/application/port/out/GetWeekMealPort.kt b/core/src/main/kotlin/com/core/application/port/out/GetWeekMealPort.kt deleted file mode 100644 index 7220fa2..0000000 --- a/core/src/main/kotlin/com/core/application/port/out/GetWeekMealPort.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.core.application.port.out - -import com.core.application.domain.meal.model.Meal -import java.time.LocalDate - -interface GetWeekMealPort { - - operator fun invoke(restaurantIdx: Long, - start: LocalDate, - end: LocalDate): List -} \ No newline at end of file diff --git a/core/src/main/resources/application.yml b/core/src/main/resources/application.yml index fb45dec..f6d9337 100644 --- a/core/src/main/resources/application.yml +++ b/core/src/main/resources/application.yml @@ -2,16 +2,9 @@ server: port: 8080 spring: - jpa: - show_sql: true - hibernate: - ddl-auto: none - properties: - hibernate: - format_sql: true - highlight_sql: true - default_batch_fetch_size: 20 - open-in-view: false + profiles: + include: + - jpa springdoc: swagger-ui: diff --git a/jpa/src/main/kotlin/com/jpa/domain/MealPersistenceAdapter.kt b/jpa/src/main/kotlin/com/jpa/domain/MealPersistenceAdapter.kt new file mode 100644 index 0000000..db4a927 --- /dev/null +++ b/jpa/src/main/kotlin/com/jpa/domain/MealPersistenceAdapter.kt @@ -0,0 +1,19 @@ +package com.jpa.domain + +import com.jpa.domain.mapper.MealMapper +import com.jpa.domain.repository.MealRepository +import com.jpa.domain.model.Meal +import org.springframework.stereotype.Component +import java.time.LocalDate + +@Component +class MealPersistenceAdapter( + private val mealRepository: MealRepository, + private val mealMapper: MealMapper +) { + fun getWeekMeals(restaurantIdx: Long, start: LocalDate, end: LocalDate): List { + val weekMeal = mealRepository.getWeekMeal(restaurantIdx, start, end) + val applicationMeals = mealMapper.toDomain(weekMeal); + return applicationMeals + } +} \ No newline at end of file diff --git a/core/src/main/kotlin/com/core/common/BaseEntity.kt b/jpa/src/main/kotlin/com/jpa/domain/common/BaseEntity.kt similarity index 95% rename from core/src/main/kotlin/com/core/common/BaseEntity.kt rename to jpa/src/main/kotlin/com/jpa/domain/common/BaseEntity.kt index 9328ae8..e0f2415 100644 --- a/core/src/main/kotlin/com/core/common/BaseEntity.kt +++ b/jpa/src/main/kotlin/com/jpa/domain/common/BaseEntity.kt @@ -1,4 +1,4 @@ -package com.core.common +package com.jpa.domain.common import jakarta.persistence.Column import jakarta.persistence.EntityListeners diff --git a/core/src/main/kotlin/com/core/adapter/out/persistence/entity/CampusJpaEntity.kt b/jpa/src/main/kotlin/com/jpa/domain/entity/CampusJpaEntity.kt similarity index 84% rename from core/src/main/kotlin/com/core/adapter/out/persistence/entity/CampusJpaEntity.kt rename to jpa/src/main/kotlin/com/jpa/domain/entity/CampusJpaEntity.kt index ecbe01a..580be4d 100644 --- a/core/src/main/kotlin/com/core/adapter/out/persistence/entity/CampusJpaEntity.kt +++ b/jpa/src/main/kotlin/com/jpa/domain/entity/CampusJpaEntity.kt @@ -1,6 +1,6 @@ -package com.core.adapter.out.persistence.entity +package com.jpa.domain.entity -import com.core.common.BaseEntity +import com.jpa.domain.common.BaseEntity import jakarta.persistence.* @Entity diff --git a/core/src/main/kotlin/com/core/adapter/out/persistence/entity/MealJpaEntity.kt b/jpa/src/main/kotlin/com/jpa/domain/entity/MealJpaEntity.kt similarity index 78% rename from core/src/main/kotlin/com/core/adapter/out/persistence/entity/MealJpaEntity.kt rename to jpa/src/main/kotlin/com/jpa/domain/entity/MealJpaEntity.kt index 5937017..b0a6b2c 100644 --- a/core/src/main/kotlin/com/core/adapter/out/persistence/entity/MealJpaEntity.kt +++ b/jpa/src/main/kotlin/com/jpa/domain/entity/MealJpaEntity.kt @@ -1,13 +1,11 @@ -package com.core.adapter.out.persistence.entity +package com.jpa.domain.entity -import com.core.adapter.out.persistence.enumerate.MealStatus -import com.core.adapter.out.persistence.enumerate.MealType -import com.core.common.BaseEntity +import com.jpa.domain.common.BaseEntity +import com.jpa.domain.enumerate.MealStatus +import com.jpa.domain.enumerate.MealType import jakarta.persistence.* -import org.hibernate.annotations.Comment import java.math.BigDecimal import java.time.LocalDate -import java.time.LocalDateTime @Entity @Table( diff --git a/core/src/main/kotlin/com/core/adapter/out/persistence/entity/RestaurantJpaEntity.kt b/jpa/src/main/kotlin/com/jpa/domain/entity/RestaurantJpaEntity.kt similarity index 87% rename from core/src/main/kotlin/com/core/adapter/out/persistence/entity/RestaurantJpaEntity.kt rename to jpa/src/main/kotlin/com/jpa/domain/entity/RestaurantJpaEntity.kt index e976535..c1948d1 100644 --- a/core/src/main/kotlin/com/core/adapter/out/persistence/entity/RestaurantJpaEntity.kt +++ b/jpa/src/main/kotlin/com/jpa/domain/entity/RestaurantJpaEntity.kt @@ -1,6 +1,6 @@ -package com.core.adapter.out.persistence.entity +package com.jpa.domain.entity -import com.core.common.BaseEntity +import com.jpa.domain.common.BaseEntity import jakarta.persistence.* @Entity diff --git a/core/src/main/kotlin/com/core/adapter/out/persistence/entity/ScrapJpaEntity.kt b/jpa/src/main/kotlin/com/jpa/domain/entity/ScrapJpaEntity.kt similarity index 87% rename from core/src/main/kotlin/com/core/adapter/out/persistence/entity/ScrapJpaEntity.kt rename to jpa/src/main/kotlin/com/jpa/domain/entity/ScrapJpaEntity.kt index 540dd01..0f29546 100644 --- a/core/src/main/kotlin/com/core/adapter/out/persistence/entity/ScrapJpaEntity.kt +++ b/jpa/src/main/kotlin/com/jpa/domain/entity/ScrapJpaEntity.kt @@ -1,4 +1,4 @@ -package com.core.adapter.out.persistence.entity +package com.jpa.domain.entity import jakarta.persistence.* import org.hibernate.annotations.Comment diff --git a/core/src/main/kotlin/com/core/adapter/out/persistence/entity/StoreJpaEntity.kt b/jpa/src/main/kotlin/com/jpa/domain/entity/StoreJpaEntity.kt similarity index 97% rename from core/src/main/kotlin/com/core/adapter/out/persistence/entity/StoreJpaEntity.kt rename to jpa/src/main/kotlin/com/jpa/domain/entity/StoreJpaEntity.kt index 3ac7822..0ffe936 100644 --- a/core/src/main/kotlin/com/core/adapter/out/persistence/entity/StoreJpaEntity.kt +++ b/jpa/src/main/kotlin/com/jpa/domain/entity/StoreJpaEntity.kt @@ -1,4 +1,4 @@ -package com.core.adapter.out.persistence.entity +package com.jpa.domain.entity import jakarta.persistence.* import org.hibernate.annotations.Comment diff --git a/core/src/main/kotlin/com/core/adapter/out/persistence/entity/UserJpaEntity.kt b/jpa/src/main/kotlin/com/jpa/domain/entity/UserJpaEntity.kt similarity index 83% rename from core/src/main/kotlin/com/core/adapter/out/persistence/entity/UserJpaEntity.kt rename to jpa/src/main/kotlin/com/jpa/domain/entity/UserJpaEntity.kt index fef20ac..6324216 100644 --- a/core/src/main/kotlin/com/core/adapter/out/persistence/entity/UserJpaEntity.kt +++ b/jpa/src/main/kotlin/com/jpa/domain/entity/UserJpaEntity.kt @@ -1,4 +1,4 @@ -package com.core.adapter.out.persistence.entity +package com.jpa.domain.entity import jakarta.persistence.* diff --git a/core/src/main/kotlin/com/core/adapter/out/persistence/enumerate/MealStatus.kt b/jpa/src/main/kotlin/com/jpa/domain/enumerate/MealStatus.kt similarity index 76% rename from core/src/main/kotlin/com/core/adapter/out/persistence/enumerate/MealStatus.kt rename to jpa/src/main/kotlin/com/jpa/domain/enumerate/MealStatus.kt index 18ffa6c..686715e 100644 --- a/core/src/main/kotlin/com/core/adapter/out/persistence/enumerate/MealStatus.kt +++ b/jpa/src/main/kotlin/com/jpa/domain/enumerate/MealStatus.kt @@ -1,4 +1,4 @@ -package com.core.adapter.out.persistence.enumerate +package com.jpa.domain.enumerate enum class MealStatus(val value: String) { OPEN("운영중"), diff --git a/core/src/main/kotlin/com/core/adapter/out/persistence/enumerate/MealType.kt b/jpa/src/main/kotlin/com/jpa/domain/enumerate/MealType.kt similarity index 72% rename from core/src/main/kotlin/com/core/adapter/out/persistence/enumerate/MealType.kt rename to jpa/src/main/kotlin/com/jpa/domain/enumerate/MealType.kt index 86bf1fc..9f34732 100644 --- a/core/src/main/kotlin/com/core/adapter/out/persistence/enumerate/MealType.kt +++ b/jpa/src/main/kotlin/com/jpa/domain/enumerate/MealType.kt @@ -1,4 +1,4 @@ -package com.core.adapter.out.persistence.enumerate +package com.jpa.domain.enumerate enum class MealType(val value: String) { BREAKFAST("조식"), diff --git a/jpa/src/main/kotlin/com/jpa/domain/global/config/JpaConfig.kt b/jpa/src/main/kotlin/com/jpa/domain/global/config/JpaConfig.kt new file mode 100644 index 0000000..2deac07 --- /dev/null +++ b/jpa/src/main/kotlin/com/jpa/domain/global/config/JpaConfig.kt @@ -0,0 +1,11 @@ +package com.jpa.domain.global.config + +import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.context.annotation.Configuration +import org.springframework.data.jpa.repository.config.EnableJpaRepositories + +@Configuration +@EnableJpaRepositories(basePackages = ["com.jpa.domain.repository"]) +@EntityScan(basePackages = ["com.jpa"]) +class JpaConfig { +} \ No newline at end of file diff --git a/core/src/main/kotlin/com/core/adapter/out/persistence/mapper/MealMapper.kt b/jpa/src/main/kotlin/com/jpa/domain/mapper/MealMapper.kt similarity index 80% rename from core/src/main/kotlin/com/core/adapter/out/persistence/mapper/MealMapper.kt rename to jpa/src/main/kotlin/com/jpa/domain/mapper/MealMapper.kt index 07ec972..5de07d0 100644 --- a/core/src/main/kotlin/com/core/adapter/out/persistence/mapper/MealMapper.kt +++ b/jpa/src/main/kotlin/com/jpa/domain/mapper/MealMapper.kt @@ -1,9 +1,9 @@ -package com.core.adapter.out.persistence.mapper +package com.jpa.domain.mapper -import com.core.adapter.out.persistence.entity.MealJpaEntity -import com.core.adapter.out.persistence.enumerate.MealStatus -import com.core.adapter.out.persistence.enumerate.MealType -import com.core.application.domain.meal.model.Meal +import com.jpa.domain.entity.MealJpaEntity +import com.jpa.domain.enumerate.MealStatus +import com.jpa.domain.enumerate.MealType +import com.jpa.domain.model.Meal import org.springframework.stereotype.Component import java.math.BigDecimal import java.time.LocalDateTime diff --git a/core/src/main/kotlin/com/core/application/domain/meal/model/Campus.kt b/jpa/src/main/kotlin/com/jpa/domain/model/Campus.kt similarity index 86% rename from core/src/main/kotlin/com/core/application/domain/meal/model/Campus.kt rename to jpa/src/main/kotlin/com/jpa/domain/model/Campus.kt index aac5a44..f3ce722 100644 --- a/core/src/main/kotlin/com/core/application/domain/meal/model/Campus.kt +++ b/jpa/src/main/kotlin/com/jpa/domain/model/Campus.kt @@ -1,4 +1,4 @@ -package com.core.application.domain.meal.model +package com.jpa.domain.model import java.time.LocalDateTime diff --git a/core/src/main/kotlin/com/core/application/domain/meal/model/Meal.kt b/jpa/src/main/kotlin/com/jpa/domain/model/Meal.kt similarity index 77% rename from core/src/main/kotlin/com/core/application/domain/meal/model/Meal.kt rename to jpa/src/main/kotlin/com/jpa/domain/model/Meal.kt index 2e041df..f76ea56 100644 --- a/core/src/main/kotlin/com/core/application/domain/meal/model/Meal.kt +++ b/jpa/src/main/kotlin/com/jpa/domain/model/Meal.kt @@ -1,7 +1,7 @@ -package com.core.application.domain.meal.model +package com.jpa.domain.model -import com.core.adapter.out.persistence.enumerate.MealStatus -import com.core.adapter.out.persistence.enumerate.MealType +import com.jpa.domain.enumerate.MealStatus +import com.jpa.domain.enumerate.MealType import java.math.BigDecimal import java.time.LocalDate import java.time.LocalDateTime diff --git a/core/src/main/kotlin/com/core/application/domain/meal/model/Restaurant.kt b/jpa/src/main/kotlin/com/jpa/domain/model/Restaurant.kt similarity index 88% rename from core/src/main/kotlin/com/core/application/domain/meal/model/Restaurant.kt rename to jpa/src/main/kotlin/com/jpa/domain/model/Restaurant.kt index b3d31cc..bb2177a 100644 --- a/core/src/main/kotlin/com/core/application/domain/meal/model/Restaurant.kt +++ b/jpa/src/main/kotlin/com/jpa/domain/model/Restaurant.kt @@ -1,4 +1,4 @@ -package com.core.application.domain.meal.model +package com.jpa.domain.model import java.time.LocalDateTime diff --git a/core/src/main/kotlin/com/core/adapter/out/persistence/repository/MealRepository.kt b/jpa/src/main/kotlin/com/jpa/domain/repository/MealRepository.kt similarity index 79% rename from core/src/main/kotlin/com/core/adapter/out/persistence/repository/MealRepository.kt rename to jpa/src/main/kotlin/com/jpa/domain/repository/MealRepository.kt index 8a17184..d76408f 100644 --- a/core/src/main/kotlin/com/core/adapter/out/persistence/repository/MealRepository.kt +++ b/jpa/src/main/kotlin/com/jpa/domain/repository/MealRepository.kt @@ -1,11 +1,10 @@ -package com.core.adapter.out.persistence.repository +package com.jpa.domain.repository -import com.core.adapter.out.persistence.entity.MealJpaEntity +import com.jpa.domain.entity.MealJpaEntity import org.springframework.data.jpa.repository.JpaRepository import org.springframework.data.jpa.repository.Query import org.springframework.stereotype.Repository import java.time.LocalDate -import java.time.LocalDateTime @Repository interface MealRepository: JpaRepository { diff --git a/jpa/src/main/resources/application-jpa.yml b/jpa/src/main/resources/application-jpa.yml new file mode 100644 index 0000000..8a4f952 --- /dev/null +++ b/jpa/src/main/resources/application-jpa.yml @@ -0,0 +1,20 @@ +spring: + datasource: + url: jdbc:mysql://localhost:3306/myongsik?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true + username: root + password: 1q2w3e4r! + jpa: + hibernate: + ddl-auto: update + show_sql: true + properties: + hibernate: + format_sql: true + highlight_sql: true + +logging: + level: + org: + hibernate: + SQL: debug + orm.jdbc.bind: trace \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 064671e..e4c89d5 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -3,4 +3,5 @@ plugins { } rootProject.name = "Server-v2" include("core") -include("admin") \ No newline at end of file +include("admin") +include("jpa") \ No newline at end of file