diff --git a/backend/src/main/java/ch/puzzle/okr/multitenancy/SchemaMultiTenantConnectionProvider.java b/backend/src/main/java/ch/puzzle/okr/multitenancy/SchemaMultiTenantConnectionProvider.java index 05ff90ce53..8e8e42077c 100644 --- a/backend/src/main/java/ch/puzzle/okr/multitenancy/SchemaMultiTenantConnectionProvider.java +++ b/backend/src/main/java/ch/puzzle/okr/multitenancy/SchemaMultiTenantConnectionProvider.java @@ -79,8 +79,8 @@ private ConnectionProvider createConnectionProvider(String tenantIdentifier) { } protected Properties getHibernatePropertiesForTenantIdentifier(String tenantIdentifier) { - Properties properties = getHibernateProperties(); - if (properties == null || properties.isEmpty()) { + Properties properties = getHibernateProperties(tenantIdentifier); + if (properties.isEmpty()) { throw new RuntimeException("Cannot load hibernate properties from application.properties)"); } if (!Objects.equals(tenantIdentifier, DEFAULT_TENANT_ID)) { @@ -109,7 +109,10 @@ private Map convertPropertiesToMap(Properties properties) { return configProperties; } - protected Properties getHibernateProperties() { - return HibernateContext.getHibernateConfig(); + protected Properties getHibernateProperties(String tenantIdentifier) { + if (tenantIdentifier.equals(DEFAULT_TENANT_ID)) { + return HibernateContext.getHibernateConfig(); + } + return HibernateContext.getHibernateConfig(tenantIdentifier); } } \ No newline at end of file