Interface TenantDataSourceMapper<T>

Type Parameters:
T - The type of the tenant id

@Incubating(since="8.0") public interface TenantDataSourceMapper<T>
Supplies the JNDI name of a DataSource for a given tenant identifier. An implementation is selected using "hibernate.multi_tenant.datasource_mapper", or obtained from the configured bean container.

Configuring a mapper automatically enables DataSourceConnectionProvider unless a connection provider or a multi-tenant connection provider is explicitly supplied.

Since:
8.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    dataSourceName(T tenantIdentifier)
    The full JNDI name of the data source belonging to the given tenant.
  • Method Details

    • dataSourceName

      @Nonnull String dataSourceName(@Nonnull T tenantIdentifier)
      The full JNDI name of the data source belonging to the given tenant. Data sources are cached, so this method need not be called for every connection.
      Parameters:
      tenantIdentifier - The tenant identifier
      Returns:
      The JNDI name of the data source belonging to that tenant