Skip to content

Commit

Permalink
Load before flush leads to exception. #1472
Browse files Browse the repository at this point in the history
  • Loading branch information
Tapac committed Apr 10, 2022
1 parent 53eaa65 commit d588404
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -223,6 +223,9 @@ private fun <ID : Comparable<ID>> List<Entity<ID>>.preloadRelations(

fun <SRCID : Comparable<SRCID>, SRC : Entity<SRCID>, REF : Entity<*>> Iterable<SRC>.with(vararg relations: KProperty1<out REF, Any?>): Iterable<SRC> =
toList().apply {
if (any { it.isNewEntity() }) {
TransactionManager.current().flushCache()
}
preloadRelations(*relations)
}

Expand Down

0 comments on commit d588404

Please sign in to comment.