generated from pricelees/issue-pr-template
feat: Auditing 없이 Persistable만 정의된 BaseEntity 추가
This commit is contained in:
parent
ed0b81ff45
commit
d0f6e0fe0c
@ -33,3 +33,22 @@ abstract class BaseEntity(
|
||||
abstract override fun getId(): Long?
|
||||
|
||||
}
|
||||
|
||||
@MappedSuperclass
|
||||
abstract class PersistableBaseEntity(
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
private val _id: Long,
|
||||
|
||||
@Transient
|
||||
private var isNewEntity: Boolean = true
|
||||
): Persistable<Long> {
|
||||
@PostLoad
|
||||
@PostPersist
|
||||
fun markNotNew() {
|
||||
isNewEntity = false
|
||||
}
|
||||
|
||||
override fun isNew(): Boolean = isNewEntity
|
||||
override fun getId(): Long = _id
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user