Issue Type: Bug Bug
Affects Versions: 4.1.5.SP1
Assignee: Unassigned
Components: core
Created: 03/Aug/12 4:10 PM
Description:

I was grateful to see built-in support for multi-tenancy. We sometimes use EhCache or Memcached for our 2nd level caching. We store slighty different versions of the same objects for each tenant.
Looking at the class org.hibernate.cache.spi.CacheKey, in the EhCache situation, the hashCode will always be the same for all tenants. This forces EhCache to iterate over all tenants with the same object in cache and rely on the equals method to find the correct one. It would seem more efficient to incorporate the tenant id into the hash code.
For Memcached, I rely on the CacheKey.toString() method to create my lookup string. This method doesn't append the tenant id which is now causing a problem of mixing up objects of different tenants. Even if I cast the key to to the CacheKey class, there is no getter method for the tenant id so I could build my own string.

Environment: Hibernate 4.1.5.SP1, EhCache, Memcached
Project: Hibernate ORM
Priority: Major Major
Reporter: J Goodfellow
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira