RE: ObjectStore help ...

From: Gentry, Michael \(Contractor\) ("Gentry,)
Date: Wed May 25 2005 - 14:37:43 EDT

  • Next message: Cris Daniluk: "Re: ObjectStore help ..."

    That sure e-mailed crappily. Here's a better (?) formatted version:
     
    Iterator currentIt = currentSnapshot.entrySet().iterator();
    while (currentIt.hasNext()) {
      Map.Entry entry = (Map.Entry) currentIt.next();
      Object newValue = entry.getValue();
      Object oldValue = committedSnapshot.get(entry.getKey());
      if (!Util.nullSafeEquals(oldValue, newValue)) {
        return true;
      }
    }

    and:
     
    oldValue
         (byte[]) [0, 0, 0, 0, 0, 0, 0, 34, 89, 45, -9, 74]
    newValue
         (byte[]) [0, 0, 0, 0, 0, 0, 0, 34, 89, 45, -9, 74]
    oldValue.equals(newValue)
         (boolean) false
    newValue.equals(oldValue)
         (boolean) false

            -----Original Message-----
            From: Michael Gentry (Yes, I'm a Contractor)
    [mailto:michael_gentr..anniemae.com]
            Sent: Wednesday, May 25, 2005 2:33 PM
            To: cayenne-deve..bjectstyle.org
            Subject: ObjectStore help ...
            
            
            I'm trying to debug why Cayenne thinks my objects are edited (it
    thinks the primary keys have been updated/changed) when they haven't
    been and I think I've finally identified the portion in the code, but it
    doesn't make much sense to me at the moment.
            
            I'm currently using Cayenne 1.1 and in ObjectStore.java
    (hasChanges() method, line 805) is this:
            
                            Iterator currentIt =
    currentSnapshot.entrySet().iterator(); while
    (currentIt.hasNext()) { Map.Entry entry = (Map.Entry)
    currentIt.next(); Object newValue = entry.getValue();
    Object oldValue = committedSnapshot.get(entry.getKey());
    if (!Util.nullSafeEquals(oldValue, newValue)) {
    return true; } }
            
            When debugging I print the old and new values (which are my
    primary key values at this point) and I get this:
            
            oldValue (byte[]) [0, 0, 0, 0, 0, 0, 0, 34, 89, 45, -9,
    74]newValue (byte[]) [0, 0, 0, 0, 0, 0, 0, 34, 89, 45, -9,
    74]oldValue.equals(newValue) (boolean) false
    newValue.equals(oldValue) (boolean) false
            
            They look equal to me, but equals() doesn't seem to agree (and
    Util.nullSafeEquals() uses equals()). Anyone have any ideas why this
    might happen?
            
            Thanks!
            
            /dev/mrg
            



    This archive was generated by hypermail 2.0.0 : Wed May 25 2005 - 14:37:47 EDT