@MappedSuperclass
@EntityListeners(AuditingEntityListener::class)
abstract class BaseEntity {
@CreatedDate
lateinit var createdDateTime: LocalDateTime
@LastModifiedDate
lateinit var modifiedDateTime: LocalDateTime
}
org.hibernate.HibernateException: Getter methods of lazy classes cannot be final:
예외 발생
@AllOpen 어노테이션을 정의하고 해당 어노테이션이 붙은 클래스들은 'open'시키도록 구현
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
annotation class AllOpen
build.gradle)
plugins {
id "org.jetbrains.kotlin.plugin.allopen" version "1.8.22"
}
allOpen {
annotation("com.testcafekiosk.spring.config.annotation.AllOpen")
}
@AllOpen 적용)
@AllOpen
@MappedSuperclass
@EntityListeners(AuditingEntityListener::class)
abstract class BaseEntity {
@CreatedDate
lateinit var createdDateTime: LocalDateTime
@LastModifiedDate
lateinit var modifiedDateTime: LocalDateTime
}
https://kotlinlang.org/docs/all-open-plugin.html#gradle
https://v3.leedo.me/devs/81