Skip to content

Commit

Permalink
EntityClass#wramUpReferences should cache reference of referrer (#1510)…
Browse files Browse the repository at this point in the history
… / Part 2
  • Loading branch information
Tapac committed Jul 17, 2022
1 parent 96ad157 commit 7341e7d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ abstract class EntityClass<ID : Comparable<ID>, out T : Entity<ID>>(
distinctRefIds.forEach { id ->
cache.getOrPutReferrers(id, refColumn) { result[id]?.let { SizedCollection(it) } ?: emptySized() }.also {
if (keepLoadedReferenceOutOfTransaction) {
cache.data[id.table]?.get(id.value)?.storeReferenceInCache(refColumn, it)
findById(id)?.storeReferenceInCache(refColumn, it)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ private fun <ID : Comparable<ID>> List<Entity<ID>>.preloadRelations(
(refObject as Referrers<ID, Entity<ID>, *, Entity<*>, Any>).reference.let { refColumn ->
val refIds = this.map { it.run { refColumn.referee<Any>()!!.lookup() } }
refObject.factory.warmUpReferences(refIds, refColumn)
storeReferenceCache(refColumn, prop)
}
}
is OptionalReferrers<*, *, *, *, *> -> {
Expand Down

0 comments on commit 7341e7d

Please sign in to comment.