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:32:54 EDT