persistence@glassfish.java.net

calling equals() on a detached object

From: jeff <jeffrey.blattman_at_yahoo.com>
Date: Wed, 14 Mar 2007 17:25:01 -0700 (PDT)

i'd like to be able to do this ...

1. create object A
2. persist object A
3. find() object B based on A's ID (they should be "equal()"
4. detach B
3. call A.equals(B) and get a true result

i've done this, and it does not work. as far as i can tell w/ the debugger, they are equal. the problem appears to be when a field of type Set is compared.

when i poke into B, and try to look into the Set, i have to bury way down in some toplink objects before i find the right values for the set, but they ARE in there somewhere.

also, to make sure B is all fetched, i called B.equals(B) before detaching, which should load everything i care about i think. if there's a better way to do this, i'd like to hear it :)

when i call toString() on the Set inside of A and B, the format is slightly different but it does contain the same data: for example ...

A's set: [zipCodes=[11111, 22222, 33333]]
B's set: {{[zipCodes=[11111, 22222, 33333]]}}

so i guess this means the same data is there, but i don't understand why "equals" is failing.

any ideas?
thanks.



 
---------------------------------
No need to miss a message. Get email on-the-go
with Yahoo! Mail for Mobile. Get started.