mirror of
https://github.com/corda/corda.git
synced 2025-06-16 22:28:15 +00:00
Merge fixes
This commit is contained in:
@ -63,7 +63,6 @@ val contextDatabaseOrNull: CordaPersistence? get() = _contextDatabase.get()
|
||||
class CordaPersistence(
|
||||
databaseConfig: DatabaseConfig,
|
||||
schemas: Set<MappedSchema>,
|
||||
val jdbcUrl: String,
|
||||
attributeConverters: Collection<AttributeConverter<*, *>> = emptySet()
|
||||
) : Closeable {
|
||||
companion object {
|
||||
@ -72,11 +71,11 @@ class CordaPersistence(
|
||||
|
||||
private val defaultIsolationLevel = databaseConfig.transactionIsolationLevel
|
||||
val hibernateConfig: HibernateConfiguration by lazy {
|
||||
|
||||
transaction {
|
||||
HibernateConfiguration(schemas, databaseConfig, attributeConverters, jdbcUrl)
|
||||
}
|
||||
}
|
||||
|
||||
val entityManagerFactory get() = hibernateConfig.sessionFactoryForRegisteredSchemas
|
||||
|
||||
data class Boundary(val txId: UUID, val success: Boolean)
|
||||
@ -84,8 +83,11 @@ class CordaPersistence(
|
||||
private var _dataSource: DataSource? = null
|
||||
val dataSource: DataSource get() = checkNotNull(_dataSource) { "CordaPersistence not started" }
|
||||
|
||||
fun start(dataSource: DataSource) {
|
||||
private lateinit var jdbcUrl: String
|
||||
|
||||
fun start(dataSource: DataSource, jdbcUrl: String) {
|
||||
_dataSource = dataSource
|
||||
this.jdbcUrl = jdbcUrl
|
||||
// Found a unit test that was forgetting to close the database transactions. When you close() on the top level
|
||||
// database transaction it will reset the threadLocalTx back to null, so if it isn't then there is still a
|
||||
// database transaction open. The [transaction] helper above handles this in a finally clause for you
|
||||
|
Reference in New Issue
Block a user