diff --git a/node/src/main/kotlin/net/corda/node/services/config/NodeConfiguration.kt b/node/src/main/kotlin/net/corda/node/services/config/NodeConfiguration.kt index 9573d768dc..3bdf57e889 100644 --- a/node/src/main/kotlin/net/corda/node/services/config/NodeConfiguration.kt +++ b/node/src/main/kotlin/net/corda/node/services/config/NodeConfiguration.kt @@ -46,7 +46,8 @@ data class DevModeOptions(val disableCheckpointChecker: Boolean = false) data class DatabaseConfig( val initDatabase: Boolean = true, val serverNameTablePrefix: String = "", - val transactionIsolationLevel: TransactionIsolationLevel = TransactionIsolationLevel.REPEATABLE_READ + val transactionIsolationLevel: TransactionIsolationLevel = TransactionIsolationLevel.REPEATABLE_READ, + val schema: String? = null ) enum class TransactionIsolationLevel { diff --git a/node/src/main/kotlin/net/corda/node/services/persistence/HibernateConfiguration.kt b/node/src/main/kotlin/net/corda/node/services/persistence/HibernateConfiguration.kt index ae346dc2b8..39ab2442b6 100644 --- a/node/src/main/kotlin/net/corda/node/services/persistence/HibernateConfiguration.kt +++ b/node/src/main/kotlin/net/corda/node/services/persistence/HibernateConfiguration.kt @@ -58,9 +58,9 @@ class HibernateConfiguration(val schemaService: SchemaService, private val datab .setProperty("hibernate.format_sql", "true") .setProperty("hibernate.connection.isolation", databaseConfig.transactionIsolationLevel.jdbcValue.toString()) - if (databaseProperties.getProperty("schema") != null) { + if (databaseConfig.schema != null) { // This property helps 'hibernate.hbm2ddl.auto' to work properly when many schemas have similar table names. - config.setProperty("hibernate.default_schema", databaseProperties.getProperty("schema")) + config.setProperty("hibernate.default_schema", databaseConfig.schema) } schemas.forEach { schema -> diff --git a/testing/node-driver/src/main/kotlin/net/corda/testing/NodeTestUtils.kt b/testing/node-driver/src/main/kotlin/net/corda/testing/NodeTestUtils.kt index bc0baefadc..3a4f0217fd 100644 --- a/testing/node-driver/src/main/kotlin/net/corda/testing/NodeTestUtils.kt +++ b/testing/node-driver/src/main/kotlin/net/corda/testing/NodeTestUtils.kt @@ -64,7 +64,7 @@ fun testNodeConfiguration( doReturn(emptyList()).whenever(it).rpcUsers doReturn(null).whenever(it).notary doReturn(makeTestDataSourceProperties(myLegalName.organisation)).whenever(it).dataSourceProperties - doReturn(DatabaseConfig(myLegalName.organisation)).whenever(it).database + doReturn(DatabaseConfig(serverNameTablePrefix = myLegalName.organisation)).whenever(it).database doReturn("").whenever(it).emailAddress doReturn("").whenever(it).exportJMXto doReturn(true).whenever(it).devMode diff --git a/testing/node-driver/src/main/kotlin/net/corda/testing/node/MockNode.kt b/testing/node-driver/src/main/kotlin/net/corda/testing/node/MockNode.kt index 3c80a84870..b1b2adcbb1 100644 --- a/testing/node-driver/src/main/kotlin/net/corda/testing/node/MockNode.kt +++ b/testing/node-driver/src/main/kotlin/net/corda/testing/node/MockNode.kt @@ -27,6 +27,7 @@ import net.corda.node.internal.StartedNode import net.corda.node.internal.cordapp.CordappLoader import net.corda.node.services.api.SchemaService import net.corda.node.services.config.BFTSMaRtConfiguration +import net.corda.node.services.config.DatabaseConfig import net.corda.node.services.config.NodeConfiguration import net.corda.node.services.config.NotaryConfig import net.corda.node.services.keys.E2ETestKeyManagementService @@ -40,7 +41,6 @@ import net.corda.node.utilities.CordaPersistence import net.corda.testing.DUMMY_NOTARY import net.corda.testing.node.MockServices.Companion.MOCK_VERSION_INFO import net.corda.testing.node.MockServices.Companion.makeTestDataSourceProperties -import net.corda.testing.node.MockServices.Companion.makeTestDatabaseProperties import net.corda.testing.setGlobalSerialization import net.corda.testing.testNodeConfiguration import org.apache.activemq.artemis.utils.ReusableLatch @@ -364,7 +364,7 @@ class MockNetwork(defaultParameters: MockNetworkParameters = MockNetworkParamete baseDirectory = baseDirectory(id).createDirectories(), myLegalName = parameters.legalName ?: CordaX500Name(organisation = "Mock Company $id", locality = "London", country = "GB")).also { doReturn(makeTestDataSourceProperties("node_$id", "net_$networkId")).whenever(it).dataSourceProperties - doReturn(makeTestDatabaseProperties("node_$id")).whenever(it).database + doReturn(DatabaseConfig()).whenever(it).database parameters.configOverrides(it) } val node = nodeFactory(MockNodeArgs(config, this, id, parameters.entropyRoot))