generated from pricelees/issue-pr-template
[#28] 쿠버네티스 환경 배포 #29
@ -3,7 +3,9 @@ package roomescape
|
|||||||
import org.springframework.boot.Banner
|
import org.springframework.boot.Banner
|
||||||
import org.springframework.boot.SpringApplication
|
import org.springframework.boot.SpringApplication
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||||
|
import org.springframework.data.jpa.repository.config.EnableJpaAuditing
|
||||||
|
|
||||||
|
@EnableJpaAuditing
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
class RoomescapeApplication
|
class RoomescapeApplication
|
||||||
|
|
||||||
|
|||||||
35
src/main/kotlin/roomescape/common/entity/BaseEntity.kt
Normal file
35
src/main/kotlin/roomescape/common/entity/BaseEntity.kt
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package roomescape.common.entity
|
||||||
|
|
||||||
|
import jakarta.persistence.*
|
||||||
|
import org.springframework.data.annotation.CreatedDate
|
||||||
|
import org.springframework.data.annotation.LastModifiedDate
|
||||||
|
import org.springframework.data.domain.Persistable
|
||||||
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
import kotlin.jvm.Transient
|
||||||
|
|
||||||
|
@MappedSuperclass
|
||||||
|
@EntityListeners(AuditingEntityListener::class)
|
||||||
|
abstract class BaseEntity(
|
||||||
|
@Column(updatable = false)
|
||||||
|
@CreatedDate
|
||||||
|
var createdAt: LocalDateTime? = null,
|
||||||
|
|
||||||
|
@LastModifiedDate
|
||||||
|
var lastModifiedAt: LocalDateTime? = null,
|
||||||
|
) : Persistable<Long> {
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private var isNewEntity: Boolean = true
|
||||||
|
|
||||||
|
@PostLoad
|
||||||
|
@PostPersist
|
||||||
|
fun markNotNew() {
|
||||||
|
isNewEntity = false
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun isNew(): Boolean = isNewEntity
|
||||||
|
|
||||||
|
abstract override fun getId(): Long?
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user