OpenJPAId hashCode() value needs to be consistent after serialization process -----------------------------------------------------------------------------
Key: OPENJPA-2043 URL: https://issues.apache.org/jira/browse/OPENJPA-2043 Project: OpenJPA Issue Type: Improvement Components: kernel Affects Versions: 2.1.2, 2.2.0 Reporter: Albert Lee Assignee: Albert Lee Priority: Minor Fix For: 2.2.0 OpenJPAId class uses the hashCode value "based on the least-derived non-object class so that user-given ids with non-exact types match ids with exact types". I.e. least-derived-non-object-superClass.class.hashCode() The hashCode of a .class object is not deterministic since it is implemented in native code. It may change from run to run, jdk or platforms. This scheme works well and is dependable only within the same jvm invocation, however if the OpenJPAId class is used as a hash key in distributed application environment, the hashCode may evaluates to different value between the client and server invocation. In a typical distributed caching scheme, the cache key is used as a discriminator to determine the partition where the cached key/value is located. If the client and server compute the key to different value, the distributed caching mechanism will fail. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira