zero_coding
08/26/2020, 11:21 AMobject Genders : Table() {
val value: Column<String> = varchar("value", 1)
val description: Column<String> = varchar("description", 20)
override val primaryKey = PrimaryKey(value)
}
As next, I would like to create an Entity class for it and I have tried:
class Gender(v: EntityID<String>) : Entity<String>(v) {
companion object : EntityClass<String, Gender>(???)
var value by Genders.value
var description by Genders.description
}
Kenneth Wußmann
08/26/2020, 11:32 AMEntityClass
expects an `IdTable`:
For example
object Genders : IdTable<String>() {
override val id = varchar("value", 20).entityId()
val description: Column<String> = varchar("description", 20)
override val primaryKey: PrimaryKey? = PrimaryKey(id)
}
class Gender(id: EntityID<String>) : Entity<String>(id) {
companion object : EntityClass<String, Gender>(Genders)
var description by Genders.description
}
You can read more about that here: https://github.com/JetBrains/Exposed/wiki/DAO#overviewzero_coding
08/26/2020, 11:38 AMIdTable
? In doc, it does not mention about the IdTable
.