Package org.hibernate.context.spi
Interface CurrentTenantIdentifierResolver<T>
-
public interface CurrentTenantIdentifierResolver<T>A callback registered with theSessionFactorythat is responsible for resolving the current tenant identifier.An implementation may be selected by setting the configuration property "hibernate.tenant_identifier_resolver".
- See Also:
Configuration.setCurrentTenantIdentifierResolver(org.hibernate.context.spi.CurrentTenantIdentifierResolver<java.lang.Object>),SessionFactoryBuilder.applyCurrentTenantIdentifierResolver(org.hibernate.context.spi.CurrentTenantIdentifierResolver<?>),TenantId,MultiTenancySettings.MULTI_TENANT_IDENTIFIER_RESOLVER
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleanisRoot(T tenantId)Does the given tenant id represent a "root" tenant with access to all partitions?TresolveCurrentTenantIdentifier()Resolve the current tenant identifier.booleanvalidateExistingCurrentSessions()Should we validate that the tenant identifier of a "current sessions" that already exists whenCurrentSessionContext.currentSession()is called matches the value returned here fromresolveCurrentTenantIdentifier()?
-
-
-
Method Detail
-
resolveCurrentTenantIdentifier
T resolveCurrentTenantIdentifier()
Resolve the current tenant identifier.- Returns:
- The current tenant identifier
-
validateExistingCurrentSessions
boolean validateExistingCurrentSessions()
Should we validate that the tenant identifier of a "current sessions" that already exists whenCurrentSessionContext.currentSession()is called matches the value returned here fromresolveCurrentTenantIdentifier()?- Returns:
trueindicates that the extra validation will be performed;falseindicates it will not.- See Also:
TenantIdentifierMismatchException
-
isRoot
default boolean isRoot(T tenantId)
Does the given tenant id represent a "root" tenant with access to all partitions?- Parameters:
tenantId- a tenant id produced byresolveCurrentTenantIdentifier()- Returns:
- true is this is root tenant
-
-