users@glassfish.java.net

refresh problem

From: <glassfish_at_javadesktop.org>
Date: Wed, 14 Mar 2007 02:56:57 PST

I all,
I have a problem using EntityManager refresh method and life cycle callback method (@PostLoad).
When I get an object from DB I esplicitly refresh this object and then I use the PostLoad callback method to set to null a transient field of the object. I act like that because the correct value of the transient field is valutated, in the application, from its textual (persistent) representation (only if the field value is null).
Now the problem is that I have noted that the memory objects which correspond to the same DB object are more than one !! In this way happens that is not set to null the transient field of my object (but that of others)...so when I re-calculate the field, because this is not set to nulI, I have the old scorrect in memory value....
Some system.out to support that I have said...
Like you can see the memory object which correspond to the same DB object (ID=166) are the same before the refresh (@a4f040 ) and afther. But in postLoad method the memory object which corresponds to DB object(ID=166) is (@1450f1f )....

Can you hel me...best regards
(prerefresh) XMLElementImpl_at_a4f040 name: string --> name ID=166
in postLoad.:XMLElementImpl_at_1450f1f name: string --> homeTelephoneNumber postLoad (ID).:166
in postLoad.:XMLElementImpl_at_1450f1f name: string --> homeTelephoneNumber
in postLoad(ID).:166
in postLoad.:XMLElementImpl_at_1450f1f name: string --> homeTelephoneNumber
in postLoad(ID).:166
in postLoad.:XMLElementImpl_at_17d812b name: string --> officeTelephoneNumber
in postLoad(ID).:202
(postrefresh) XMLElementImpl_at_a4f040 name: string --> homeTelephoneNumber ID=166
[Message sent by forum member 'travis_73' (travis_73)]

http://forums.java.net/jive/thread.jspa?messageID=207820