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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With