HHH-15422 Update corresponding documentation

This commit is contained in:
Yanming Zhou 2024-07-24 15:06:07 +08:00 committed by Christian Beikov
parent 7c315fdbfa
commit 657e7a278a
2 changed files with 3 additions and 1 deletions

View File

@ -320,6 +320,7 @@ To make use of multi-tenancy, we'll usually need to set at least one of these co
| `hibernate.multi_tenant_connection_provider` | Specifies the `MultiTenantConnectionProvider` | `hibernate.multi_tenant_connection_provider` | Specifies the `MultiTenantConnectionProvider`
|=== |===
Do not configure those properties if you would like the configured `BeanContainer` provide the implementation.
A longer discussion of multi-tenancy may be found in the {multitenacy-doc}[User Guide]. A longer discussion of multi-tenancy may be found in the {multitenacy-doc}[User Guide].
[[custom-sql]] [[custom-sql]]

View File

@ -118,6 +118,7 @@ The `MultiTenantConnectionProvider` to use can be specified in a number of ways:
* Use the `hibernate.multi_tenant_connection_provider` setting. * Use the `hibernate.multi_tenant_connection_provider` setting.
It could name a `MultiTenantConnectionProvider` instance, a `MultiTenantConnectionProvider` implementation class reference or a `MultiTenantConnectionProvider` implementation class name. It could name a `MultiTenantConnectionProvider` instance, a `MultiTenantConnectionProvider` implementation class reference or a `MultiTenantConnectionProvider` implementation class name.
* Provided by the configured `BeanContainer`.
* Passed directly to the `org.hibernate.boot.registry.StandardServiceRegistryBuilder`. * Passed directly to the `org.hibernate.boot.registry.StandardServiceRegistryBuilder`.
* If none of the above options match, but the settings do specify a `hibernate.connection.datasource` value, * If none of the above options match, but the settings do specify a `hibernate.connection.datasource` value,
Hibernate will assume it should use the specific `DataSourceBasedMultiTenantConnectionProviderImpl` implementation which works on a number of pretty reasonable assumptions when running inside of an app server and using one `javax.sql.DataSource` per tenant. Hibernate will assume it should use the specific `DataSourceBasedMultiTenantConnectionProviderImpl` implementation which works on a number of pretty reasonable assumptions when running inside of an app server and using one `javax.sql.DataSource` per tenant.
@ -161,7 +162,7 @@ include::{example-dir-multitenancy}/AbstractMultiTenancyTest.java[tags=multitena
`org.hibernate.context.spi.CurrentTenantIdentifierResolver` is a contract for Hibernate to be able to resolve what the application considers the current tenant identifier. `org.hibernate.context.spi.CurrentTenantIdentifierResolver` is a contract for Hibernate to be able to resolve what the application considers the current tenant identifier.
The implementation to use can be either passed directly to `Configuration` via its `setCurrentTenantIdentifierResolver` method, The implementation to use can be either passed directly to `Configuration` via its `setCurrentTenantIdentifierResolver` method,
or be specified via the `hibernate.tenant_identifier_resolver` setting. or be specified via the `hibernate.tenant_identifier_resolver` setting, or be provided by the configured `BeanContainer`.
There are two situations where `CurrentTenantIdentifierResolver` is used: There are two situations where `CurrentTenantIdentifierResolver` is used: