db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker Identity.java
Date Mon, 20 Sep 2004 13:43:00 GMT
arminw      2004/09/20 06:43:00

  Modified:    src/java/org/apache/ojb/broker Identity.java
  Log:
  merge with branch
  
  - change order of objects when generating Identity#hashCode
  Seems this way Identiy collision will be reduced
  
  Revision  Changes    Path
  1.38      +9 -3      db-ojb/src/java/org/apache/ojb/broker/Identity.java
  
  Index: Identity.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/Identity.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- Identity.java	6 Jul 2004 10:01:03 -0000	1.37
  +++ Identity.java	20 Sep 2004 13:43:00 -0000	1.38
  @@ -342,12 +342,18 @@
           if(m_hashCode == null)
           {
               HashCodeBuilder hb = new HashCodeBuilder();
  -            hb.append(getObjectsTopLevelClass().hashCode());
  -
               for (int i = 0; i < m_pkValues.length; i++)
               {
               	hb.append(m_pkValues[i]);
               }
  +            /*
  +            the hashcode of different objects to be unique across different
  +            JVM and have to be the same for the same object in different JVM,
  +            so we can't use
  +            hb.append(getObjectsTopLevelClass().hashCode());
  +            because Class identity is not same in different JVM
  +            */
  +            hb.append(getObjectsTopLevelClass().getName().hashCode());
               m_hashCode = new Integer(hb.toHashCode());
           }
           return m_hashCode.intValue();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message