How can I have a default value for an associated entity?
I have this Guild entity, that I want it to have a default config
Copy code
@KomapperEntity
@KomapperAggregateRoot("guilds")
@KomapperOneToOne(targetEntity = MarkovConfig::class)
@KomapperOneToMany(targetEntity = Filter::class, navigator = "filters")
@KomapperOneToMany(targetEntity = DBMessage::class, navigator = "messages")
data class Guild(
@KomapperId
@KomapperColumn("GUILD_ID")
val id: Snowflake
)
@KomapperEntity
@KomapperOneToOne(targetEntity = Guild::class)
data class MarkovConfig(
@KomapperId
val id: Int = 0,
val guildId: Snowflake,
val enabled: Boolean = true,
val frequency: Float = 0.5f,
val handleMention: Boolean = true
)
t
Toshihiro Nakamura
05/12/2023, 1:03 PM
If a database column has a value of NULL, do you want to set a default value for the property corresponding to that column? Unfortunately that is not supported.
z
zt
05/12/2023, 6:30 PM
Well every guild should have a Markov config instance, it should never be null ideally