Why are we using identityHashCode (code snippet given below) to build
the hash key for the object to be put in the Cache? Is there any config
setting to prevent this?

In distributed Caching scenario, this will create different hash keys
for the same query with the exact same parameters. This also means that,
the existing OSCACHE implementation cannot be used in a distributed
scenario.

//from the class SqlMapExecutorDelegate
public int hashCode() {
    CacheKey key = new CacheKey();
    if (txManager != null) {
      key.update(txManager);
      if (txManager.getConfig().getDataSource() != null) {
        key.update(txManager.getConfig().getDataSource());
      }
    }
    key.update(System.identityHashCode(this));
    return key.hashCode();
  }

Regards
Sijo Mathew

Reply via email to