mirror of
https://github.com/corda/corda.git
synced 2025-03-22 12:05:59 +00:00
ENT-6092 Add flush to MockServices.withEntityManager
(#4180)
This commit is contained in:
parent
d214f5ecbf
commit
682de39d4c
@ -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…
x
Reference in New Issue
Block a user