Hibernate 4.1.1 Multi-tenancy CurrentTenantIdentifierResolver approach, any example. My concern is how the hibernate cache will be updated when we switch schema/tenant.
Any help will be appreciated.
Hibernate 4.1.1 Multi-tenancy CurrentTenantIdentifierResolver approach, any example. My concern is how the hibernate cache will be updated when we switch schema/tenant.
Any help will be appreciated.
As per the Hibernate documentation on multi-tenancy:
16.3.3. Caching
Multi-tenancy support in Hibernate works seamlessly with the Hibernate second level cache. The key used to cache data encodes the tenant identifier.
Which basically means that instead of Hibernate using the UID of the entity, it uses the identifier returned by CurrentTenantIdentifierResolver.resolveCurrentTenantIdentifier()
plus the entity UID. This means each entity in the cache is unique to its schema.