Is it possible to do polymorphic serialization based on the presence or absence of a field? I want to have the following hierarchy for a DB entity
Copy code
sealed interface Entity {
val commonProperty: Int
class New(override val commonProperty: Int) : Entity
class Persisted(
val id: Long,
override val commonProperty: Int
) : Entity
}