Skip to content

Commit

Permalink
use HibernateContext.getHibernateConfig() methods (with and without t…
Browse files Browse the repository at this point in the history
…enantId)
  • Loading branch information
clean-coder committed Nov 4, 2024
1 parent 8f4d382 commit f8dcf4f
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -109,7 +109,10 @@ private Map<String, Object> 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);
}
}

0 comments on commit f8dcf4f

Please sign in to comment.