Hi! I am wondering if it is possible to set a rela...
# exposed
s
Hi! I am wondering if it is possible to set a related entity without fetching the related entity first, possibly through the id. I did something like this but got an error when I try to set the entity:
Copy code
// entities
class FooEntity(id: EntityID<UUID>) : UUIDEntity(id = id) {
    var bar by BarEntity referencedOn FooTable.bar
}

class BarEntity(id: EntityID<UUID>) : UUIDEntity(id = id) {

}

// attempt at inserting
FooEntity[<random-id>].bar = BarEntity(id = EntityID(id = <id>, table = BarTable))

// instead of
FooEntity[<random-id>].bar = BarEntity[<id>]
I am trying to do it this way because of performance; not having to fetch the full
BarEntity
but maybe that isn’t necessarily a concern with Exposed