Wyatt Kennedy
10/04/2023, 3:20 AMWyatt Kennedy
10/04/2023, 3:28 AMUserEntity and an entity named UserDataEntity where UserDataEntity is many to one on UserEntity. When I fetch (UserTable innerJoin UserDataTable) and then use UserEntity.wrapRows(query) , the fetch selects all the fields of UserTable and UserDataTable. However, if I try to use result.data.<property> where data is the referencedOn property targeting UserDataEntity, it refetches the same info from UserDataTable.Wyatt Kennedy
10/11/2023, 1:15 AMWyatt Kennedy
10/11/2023, 1:15 AMprivate fun fetch(init : SqlExpressionBuilder.() -> Op<Boolean>) : UserDto? {
val result = (UserTable innerJoin UserDataTable)
.select(SqlExpressionBuilder.init())
.toList()
.firstOrNull()
?: return null
val ent = UserEntity.wrapRow(result)
UserDataEntity.wrapRow(result) // with this, the print statement below does not cause another fetch.
println(ent.data.salt)
return ent.toDto()
}Wyatt Kennedy
10/11/2023, 1:17 AM