How to create an entity without `transaction` and ...
# exposed
z
How to create an entity without
transaction
and later do the transaction.
k
Hey,
new
already wants to create the
Gender
in the database. That’s why you need a
transaction
. I guess you could instantiate a
Gender
yourself:
Copy code
val g = Gender(EntityID("M", Genders))
Which would imply that a
Gender
with id
M
already exists. But usually you would either insert or select to get an instance. So rather:
Copy code
val g = transaction { Gender.findById("M") }