The original issue was fixed in TopLink 10.x under bug/patch 6865193 -
INVALID OBJECTS IN CACHE SHOULD BE REFRESHED WHEN REGISTERED IN UOW.
But now I'm testing my production application using EclipseLink 1.1.1
RC1 and the bug is back. Simple test case doesn't fail! So besides
answering questions below, if someone wants to have a live trace session
on my desktop using my application for test case that's a possibility.
In the stack below getAndCloneCacheKeyFromParent is called with
shouldReturnInvalidatedObjects == true while the object is invalid, so
the code in getAndCloneCacheKeyFromParent still return the object
because of this condition:
if ((cacheKey != null) && (shouldReturnInvalidatedObjects ||
!descriptor.getCacheInvalidationPolicy().isInvalidated(cacheKey))) {
Strangely the caller passing true for shouldReturnInvalidatedObjects has
this comment:
//Bug#4613774 In the parent session, only return the object if it has
not been Invalidated
return getAndCloneCacheKeyFromParent(primaryKey, theClass,
shouldReturnInvalidatedObjects, descriptor);
True is hardcoded in the code of line 327:
*public* Object getFromIdentityMap(Vector primaryKey, Class theClass,
ClassDescriptor descriptor) {
*return* getFromIdentityMap(primaryKey, theClass, *true*,
descriptor);
}
So the questions are:
1- Does the following comment wrong? only return the object if it has
not been Invalidated
2- Should line 327 be modified to pass false?
3- Where is the responsibility to refresh the invalid object?
Daemon Thread [WebContainer : 0] (Suspended)
UnitOfWorkIdentityMapAccessor.getAndCloneCacheKeyFromParent(Vector,
Class, boolean, ClassDescriptor) line: 136
UnitOfWorkIdentityMapAccessor.getFromIdentityMap(Vector, Class,
boolean, ClassDescriptor) line: 110
UnitOfWorkIdentityMapAccessor(IdentityMapAccessor).getFromIdentityMap(Vector,
Class, ClassDescriptor) line: 327
UnitOfWorkImpl.registerExistingObject(Object, ClassDescriptor)
line: 3781
UnitOfWorkImpl.registerExistingObject(Object) line: 3741
OneToOneMapping(ObjectReferenceMapping).buildCloneForPartObject(Object,
Object, Object, UnitOfWorkImpl, boolean) line: 68
NoIndirectionPolicy.cloneAttribute(Object, Object, Object,
UnitOfWorkImpl, boolean) line: 72
OneToOneMapping(ForeignReferenceMapping).buildClone(Object,
Object, UnitOfWorkImpl) line: 156
ObjectBuilder.populateAttributesForClone(Object, Object,
UnitOfWorkImpl) line: 2627
UnitOfWorkImpl.populateAndRegisterObject(Object, Object, CacheKey,
CacheKey, ClassDescriptor) line: 3537
UnitOfWorkImpl.cloneAndRegisterObject(Object, CacheKey, CacheKey,
ClassDescriptor) line: 923
UnitOfWorkImpl.cloneAndRegisterObject(Object, CacheKey,
ClassDescriptor) line: 832
UnitOfWorkIdentityMapAccessor.getAndCloneCacheKeyFromParent(Vector,
Class, boolean, ClassDescriptor) line: 171
UnitOfWorkIdentityMapAccessor.getFromIdentityMap(Vector, Class,
boolean, ClassDescriptor) line: 110
UnitOfWorkIdentityMapAccessor(IdentityMapAccessor).getFromIdentityMap(Vector,
Class, ClassDescriptor) line: 327
UnitOfWorkImpl.registerExistingObject(Object, ClassDescriptor)
line: 3781
UnitOfWorkImpl.registerExistingObject(Object) line: 3741
ReadObjectQuery(ObjectBuildingQuery).registerIndividualResult(Object,
UnitOfWorkImpl, JoinedAttributeManager) line: 362
ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuildingQuery,
AbstractRecord, UnitOfWorkImpl, Vector, ClassDescriptor,
JoinedAttributeManager) line: 584
ObjectBuilder.buildObjectInUnitOfWork(ObjectBuildingQuery,
JoinedAttributeManager, AbstractRecord, UnitOfWorkImpl, Vector,
ClassDescriptor) line: 544
ObjectBuilder.buildObject(ObjectBuildingQuery, AbstractRecord,
JoinedAttributeManager) line: 485
ObjectBuilder.buildObject(ObjectLevelReadQuery, AbstractRecord)
line: 437
ReadObjectQuery(ObjectLevelReadQuery).buildObject(AbstractRecord)
line: 569
ReadObjectQuery.registerResultInUnitOfWork(Object, UnitOfWorkImpl,
AbstractRecord, boolean) line: 712
ReadObjectQuery.executeObjectLevelReadQuery() line: 436
ReadObjectQuery(ObjectLevelReadQuery).executeDatabaseQuery() line:
928
ReadObjectQuery(DatabaseQuery).execute(AbstractSession,
AbstractRecord) line: 664
ReadObjectQuery(ObjectLevelReadQuery).execute(AbstractSession,
AbstractRecord) line: 889
ReadObjectQuery.execute(AbstractSession, AbstractRecord) line:
397
ReadObjectQuery(ObjectLevelReadQuery).executeInUnitOfWork(UnitOfWorkImpl,
AbstractRecord) line: 952
UnitOfWorkImpl.internalExecuteQuery(DatabaseQuery, AbstractRecord)
line: 2755
UnitOfWorkImpl(AbstractSession).executeQuery(DatabaseQuery,
AbstractRecord, int) line: 1181
------------------------------------------------------------------------
_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev