Package org.hibernate.context.spi
Interface CurrentTenantIdentifierResolver
-
public interface CurrentTenantIdentifierResolver
A callback registered with theSessionFactory
that is responsible for resolving the current tenant identifier for use withCurrentSessionContext
andSessionFactory.getCurrentSession()
.- See Also:
TenantId
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean
isRoot(String tenantId)
Does the given tenant id represent a "root" tenant with access to all partitions.String
resolveCurrentTenantIdentifier()
Resolve the current tenant identifier.boolean
validateExistingCurrentSessions()
Should we validate that the tenant identifier on "current sessions" that already exist whenCurrentSessionContext.currentSession()
is called matches the value returned here fromresolveCurrentTenantIdentifier()
?
-
-
-
Method Detail
-
resolveCurrentTenantIdentifier
String resolveCurrentTenantIdentifier()
Resolve the current tenant identifier.- Returns:
- The current tenant identifier
-
validateExistingCurrentSessions
boolean validateExistingCurrentSessions()
Should we validate that the tenant identifier on "current sessions" that already exist whenCurrentSessionContext.currentSession()
is called matches the value returned here fromresolveCurrentTenantIdentifier()
?- Returns:
true
indicates that the extra validation will be performed;false
indicates it will not.- See Also:
TenantIdentifierMismatchException
-
isRoot
default boolean isRoot(String 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
-
-