Hi, I have an entities for example from exposed wiki
Copy code
object Users: IntIdTable() {
val name = varchar("name", 50)
}
class User(id: EntityID<Int>): IntEntity(id) {
companion object : IntEntityClass<User>(Users)
var name by Users.name
}
object UserRatings: IntIdTable() {
val value = long("value")
val user = reference("user", Users)
}
class UserRating(id: EntityID<Int>): IntEntity(id) {
companion object : IntEntityClass<UserRating>(UserRatings)
var value by UserRatings.value
var user by User referencedOn UserRatings.user
}
When i want to create new UserRating i get id of user, and value (5 star etc)
Copy code
val movie = UserRating.new {
value = 5
user = ? // This expects an User object
}
How can I use only id when creating UserRating? Or do i have to get User from db with selectById? (Isn’t it unneccesarry get operation?)