users@glassfish.java.net

Re: refresh problem

From: <glassfish_at_javadesktop.org>
Date: Mon, 19 Mar 2007 04:05:42 PST

I gyorke,
I try to explain better the problem...

- TOPLINK EXECUTION
before refresh:
objectid(hashCode) = @c5a2f7
database ID = 149
transient field = name;
persistent textual field = name;

start ----> refresh the object with hashCode = @c5a2f7
        in postLoad method:
        objectid(hashCode) = @1152c0e
        persistent textual field = homeTelephoneNumber.phoneNumber
        database ID = 149
      
        in postLoad method:
        objectid(hashCode) = @1152c0e
        persistent textual field = homeTelephoneNumber.phoneNumber
        database ID = 149

        in postLoad method:
        objectid(hashCode) = @9f784d
        persistent textual field = officeTelephoneNumber.phoneNumber
        database ID = 193
finish <---- refresh the object with hashCode = @c5a2f7

post refresh:
objectid(hashCode) = @c5a2f7
database ID = 149
transient field = name;
persistent textual field = homeTelephoneNumber.phoneNumber;

Like you can see in "toplink execution" no postLoad method is invoked on the original object (@c5a2f7) !!!
Now I have tried to exectute the same application with hibernate.

- HIBERNATE EXECUTION
before refresh:
objectid(hashCode) = @11de95a
database ID = 150
transient field = name;
persistent textual field = name;

start ----> refresh the object with hashCode = @11de95a
        in postLoad method:
        objectid(hashCode) = @11de95a
        persistent textual field = homeTelephoneNumber.phoneNumber
        database ID = 150
      
        in postLoad method:
        objectid(hashCode) = @912767
        persistent textual field = officeTelephoneNumber.phoneNumber
        database ID = 191
finish <---- refresh the object with hashCode = @11de95a

post refresh:
objectid(hashCode) = @11de95a
database ID = 150
transient field = homeTelephoneNumber.phoneNumber;
persistent textual field = homeTelephoneNumber.phoneNumber;

Like you can see in the "hibernate execution" the postLoad method is invoked also on the original object (@11de95a) on which I have executed the refresh operation.

Now the method which gets the transient value returns the actual value if it is not null or recalculates the value from the persistent field...and therfore, like you can see, in toplink execution the transient field has not been recalculated (transient field = name because it has not been setted to null by the posload method) while in hibernate execution transient field has been recalculated (transient field = homeTelephoneNumber.phoneNumber because the postload method has setted the transient value to null).

best regards...
[Message sent by forum member 'travis_73' (travis_73)]

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