zero_coding
08/30/2020, 8:49 AMclass Gender(id: EntityID<String>) : Entity<String>(id) {
companion object : EntityClass<String, Gender>(Genders)
var description by Genders.description
}
and a new entity without transaction
val g = Gender.new("M") {
description = "Male"
}
because I only need an instance of Gender
I tried to compile the code above but it shows:
Exception in thread "main" java.lang.IllegalStateException: No transaction in context.
at org.jetbrains.exposed.sql.transactions.TransactionManager$Companion.current(TransactionApi.kt:98)
at org.jetbrains.exposed.dao.EntityClass.new(EntityClass.kt:237)
at io.databaker.MainKt.main(Main.kt:116)