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:41:46 GMT
arminw      2004/09/20 06:41:46

  Modified:    src/java/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
                        Identity.java
  Log:
  change order of objects when generating Identity#hashCode
  Seems this way Identiy collision will be reduced
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.36.2.3  +8 -7      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.36.2.2
  retrieving revision 1.36.2.3
  diff -u -r1.36.2.2 -r1.36.2.3
  --- Identity.java	18 Sep 2004 13:05:55 -0000	1.36.2.2
  +++ Identity.java	20 Sep 2004 13:41:46 -0000	1.36.2.3
  @@ -342,17 +342,18 @@
           if(m_hashCode == null)
           {
               HashCodeBuilder hb = new HashCodeBuilder();
  +            for (int i = 0; i < m_pkValues.length; i++)
  +            {
  +            	hb.append(m_pkValues[i]);
  +            }
               /*
  -            the hashcode have to unique across different JVM, so we can't use
  +            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());
  -
  -            for (int i = 0; i < m_pkValues.length; i++)
  -            {
  -            	hb.append(m_pkValues[i]);
  -            }
               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