Class DataSourceTenantConnectionResolver

  • All Implemented Interfaces:
    TenantConnectionResolver

    public class DataSourceTenantConnectionResolver
    extends Object
    implements TenantConnectionResolver
    Creates a database connection based on the data sources in the configuration file. The tenant identifier is used as the data source name.
    Author:
    Michael Schnell
    • Constructor Detail

      • DataSourceTenantConnectionResolver

        public DataSourceTenantConnectionResolver()
      • DataSourceTenantConnectionResolver

        public DataSourceTenantConnectionResolver​(String persistenceUnitName,
                                                  Optional<String> dataSourceName,
                                                  MultiTenancyStrategy multiTenancyStrategy,
                                                  String multiTenancySchemaDataSourceName)
    • Method Detail

      • resolve

        public org.hibernate.engine.jdbc.connections.spi.ConnectionProvider resolve​(String tenantId)
        Description copied from interface: TenantConnectionResolver
        Returns a connection provider for the current tenant based on the context.
        Specified by:
        resolve in interface TenantConnectionResolver
        Parameters:
        tenantId - the tenant identifier. Required value that cannot be null.
        Returns:
        Hibernate connection provider for the current provider. A non-null value is required.