generated from pricelees/issue-pr-template
[#41] 예약 스키마 재정의 #42
@ -1,11 +1,6 @@
|
||||
package roomescape.common.entity
|
||||
|
||||
import jakarta.persistence.Column
|
||||
import jakarta.persistence.EntityListeners
|
||||
import jakarta.persistence.Id
|
||||
import jakarta.persistence.MappedSuperclass
|
||||
import jakarta.persistence.PostLoad
|
||||
import jakarta.persistence.PrePersist
|
||||
import jakarta.persistence.*
|
||||
import org.springframework.data.annotation.CreatedBy
|
||||
import org.springframework.data.annotation.CreatedDate
|
||||
import org.springframework.data.annotation.LastModifiedBy
|
||||
@ -13,17 +8,13 @@ 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 AuditingBaseEntity(
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
private val _id: Long,
|
||||
|
||||
@Transient
|
||||
private var isNewEntity: Boolean = true
|
||||
) : Persistable<Long> {
|
||||
id: Long,
|
||||
) : BaseEntityV2(id) {
|
||||
@Column(updatable = false)
|
||||
@CreatedDate
|
||||
lateinit var createdAt: LocalDateTime
|
||||
@ -43,6 +34,17 @@ abstract class AuditingBaseEntity(
|
||||
@LastModifiedBy
|
||||
var updatedBy: Long = 0L
|
||||
protected set
|
||||
}
|
||||
|
||||
@MappedSuperclass
|
||||
abstract class BaseEntityV2(
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
private val _id: Long,
|
||||
|
||||
@Transient
|
||||
private var isNewEntity: Boolean = true
|
||||
) : Persistable<Long> {
|
||||
|
||||
@PostLoad
|
||||
@PrePersist
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user