Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] INVALIDATE_CHANGED_OBJECTS does not invalidate related objects

We recently changed our cache synchronization type from
SEND_NEW_OBJECTS_WITH_CHANGES to  INVALIDATE_CHANGED_OBJECTS. Upon testing,
we discovered that changes made through server1 were not reflected on
server2. After further testing, we found that when another object has a
direct reference to the invalidated object on the remote server, and you
access the invalidated object through that reference, you get the old
invalid instance.

For example:

1. Assume this object graph: a->b (object a refers to object b).

2. Assume object b has a field "someField" with a value "oldValue"

3. Assume both a and b are in the cache on both servers.

4. On server1, you do this: a.getB().setSomeField("newValue"), then commit
the transaction

5. Now on server2, you get a reference to "a" from EclipseLink: a =
findById(A.class, A_ID)

6. Finally, you access object "b" through object "a":
a.getB().getSomeField()

The value you get in step 6 is "oldValue" instead of "newValue".

EclipseLink invalidates the instance of "b" in server2 cache, but not the
instance of "a". So if we access "b" through "a", we get the old invalid
object.

Is this expected behavior? Based on this discussion 
http://forums.oracle.com/forums/thread.jspa?threadID=982925&tstart=298
http://forums.oracle.com/forums/thread.jspa?threadID=982925&tstart=298 , it
seems it is the expected behavior. I did not see anything in EclipseLink
documentation or javadocs describing this behavior.

To me this makes the setting INVALIDATE_CHANGED_OBJECTS not very useful
since we often access objects through the object graph. Am I missing
something?
-- 
View this message in context: http://old.nabble.com/INVALIDATE_CHANGED_OBJECTS-does-not-invalidate-related-objects-tp29432889p29432889.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top