mirror of
https://github.com/corda/corda.git
synced 2024-12-19 04:57:58 +00:00
Merge pull request #6852 from corda/dan/ENT-6092-port-to-os
ENT-6092 Add flush to `MockServices.withEntityManager` (#4180)
This commit is contained in:
commit
ade302be73
@ -251,11 +251,15 @@ open class MockServices private constructor(
|
||||
override fun jdbcSession(): Connection = persistence.createSession()
|
||||
|
||||
override fun <T : Any?> withEntityManager(block: EntityManager.() -> T): T {
|
||||
return block(contextTransaction.entityManager)
|
||||
return contextTransaction.entityManager.run {
|
||||
block(this).also { flush () }
|
||||
}
|
||||
}
|
||||
|
||||
override fun withEntityManager(block: Consumer<EntityManager>) {
|
||||
return block.accept(contextTransaction.entityManager)
|
||||
return contextTransaction.entityManager.run {
|
||||
block.accept(this).also { flush () }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user