ENT-1627 - Allow to set hibernate.dialect setting for pluggable database (#687)

Optional property `database.hibernateDialect` which maps to `hibernate.dialect`.
This commit is contained in:
szymonsztuka 2018-04-26 19:05:55 +01:00 committed by GitHub
parent a275aec546
commit cec2f25c67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 1 deletions

View File

@ -37,6 +37,8 @@ Unreleased
* Fixed node's behaviour on startup when there is no connectivity to network map. Node continues to work normally if it has * Fixed node's behaviour on startup when there is no connectivity to network map. Node continues to work normally if it has
all the needed network data, waiting in the background for network map to become available. all the needed network data, waiting in the background for network map to become available.
* Added `database.hibernateDialect` node configuration option
.. _changelog_r3_v3: .. _changelog_r3_v3:
R3 Corda 3.0 Developer Preview R3 Corda 3.0 Developer Preview

View File

@ -78,6 +78,9 @@ absolute path to the node's base directory.
:schema: (optional) some database providers require a schema name when generating DDL and SQL statements. :schema: (optional) some database providers require a schema name when generating DDL and SQL statements.
(the value is passed to Hibernate property 'hibernate.default_schema'). (the value is passed to Hibernate property 'hibernate.default_schema').
:hibernateDialect: (optional) for explicit definition of ``hibernate.dialect`` property, for most cases Hibernate properly detect
the correct value
:dataSourceProperties: This section is used to configure the jdbc connection and database driver used for the nodes persistence. :dataSourceProperties: This section is used to configure the jdbc connection and database driver used for the nodes persistence.
Currently the defaults in ``/node/src/main/resources/reference.conf`` are as shown in the first example. This is currently Currently the defaults in ``/node/src/main/resources/reference.conf`` are as shown in the first example. This is currently
the only configuration that has been tested, although in the future full support for other storage layers will be validated. the only configuration that has been tested, although in the future full support for other storage layers will be validated.

View File

@ -35,7 +35,8 @@ data class DatabaseConfig(
val runMigration: Boolean = false, val runMigration: Boolean = false,
val transactionIsolationLevel: TransactionIsolationLevel = TransactionIsolationLevel.REPEATABLE_READ, val transactionIsolationLevel: TransactionIsolationLevel = TransactionIsolationLevel.REPEATABLE_READ,
val schema: String? = null, val schema: String? = null,
val exportHibernateJMXStatistics: Boolean = false val exportHibernateJMXStatistics: Boolean = false,
val hibernateDialect: String? = null
) )
// This class forms part of the node config and so any changes to it must be handled with care // This class forms part of the node config and so any changes to it must be handled with care

View File

@ -90,6 +90,9 @@ class HibernateConfiguration(
} }
config.setProperty("hibernate.default_schema", schemaName) config.setProperty("hibernate.default_schema", schemaName)
} }
databaseConfig.hibernateDialect?.apply {
config.setProperty("hibernate.dialect", this)
}
schemas.forEach { schema -> schemas.forEach { schema ->
// TODO: require mechanism to set schemaOptions (databaseSchema, tablePrefix) which are not global to session // TODO: require mechanism to set schemaOptions (databaseSchema, tablePrefix) which are not global to session