is there any way to always eager load an related e...
# exposed
m
is there any way to always eager load an related entity,
Copy code
class UserEntity {
  val roles by ...
}
so always eager loading the roles without having to include the
load
or
with
in every query
c
Hi @minivac Some
EntityClass
functions are open, so you could for example override
all()
to always eager load:
Copy code
class UserEntity(id: EntityID<Int>) : IntEntity(id) {
    companion object : IntEntityClass<UserEntity>(UserTable) {
        override fun all(): SizedIterable<UserEntity> = super.all().with(UserEntity::roles)
    }

    val roles by RoleEntity referrersOn RoleTable.user
}
👌 1
👍🏾 1