-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b02e96
commit 513d398
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package repo.jpa | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import jakarta.persistence.* | ||
import org.springframework.data.annotation.CreatedDate | ||
import org.springframework.data.annotation.LastModifiedDate | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener | ||
import java.time.LocalDateTime | ||
|
||
@MappedSuperclass | ||
@JsonIgnoreProperties(value = ["createdAt, modifiedAt"], allowGetters = true) | ||
@EntityListeners(AuditingEntityListener::class) | ||
abstract class BaseEntity { | ||
/** 생성일 */ | ||
@CreatedDate | ||
@Column(name = "created_at", columnDefinition = "datetime default CURRENT_TIMESTAMP") | ||
@EntityTimeJsonFormat | ||
var createdAt: LocalDateTime = LocalDateTime.now() | ||
|
||
/** 수정일 */ | ||
@LastModifiedDate | ||
@Column(name = "modified_at", columnDefinition = "datetime default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | ||
@EntityTimeJsonFormat | ||
var modifiedAt: LocalDateTime = LocalDateTime.now() | ||
|
||
/** 삭제 여부 */ | ||
@Column(name = "deleted", columnDefinition = "boolean default false") | ||
var deleted: Boolean = false | ||
} |