ismar
01/06/2025, 12:43 PMEntityHook
interceptor and the Updated
action). However, the changedEntity.writeValues
is always empty in the BaseEntityClass
, even when there is a change to one or more properties of the Entity. Any hints on what Im doing wrong?Nikola
01/16/2025, 5:03 PMabstract class BaseEntity(id: EntityID<Int>, table: BaseTable) : IntEntity(id) {
val createdAt by table.createdAt
var updatedAt by table.updatedAt
var isDeleted by table.isDeleted
}
abstract class BaseEntityClass<E : BaseEntity>(table: BaseTable) : IntEntityClass<E>(table) {
init {
EntityHook.subscribe { action ->
if (action.changeType == EntityChangeType.Updated) {
action.toEntity(this)?.updatedAt = Instant.now()
}
}
}
}
open class BaseTable(name: String) : IntIdTable(name) {
var createdAt = timestamp("created_at").defaultExpression(CurrentTimestamp)
var updatedAt = timestamp("updated_at").defaultExpression(CurrentTimestamp)
var isDeleted = bool("is_deleted").default(false)
companion object : IntIdTable()
}
ismar
01/17/2025, 2:19 PM