| Summary: | FetchGroupManager.shouldWriteInto is wrong | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Andrei Ilitchev <andrei.ilitchev> |
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
The patch checked into trunk and 2.1.1 Reviewed by James. The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
The method suppose to return true if the clone has a fetch group, which doesn't cover the fetch group of the source object (there is at least one attribute in source fetch group that is not in target fetch group). Currently: public boolean shouldWriteInto(Object cachedObject, Object clone) { if (isPartialObject(clone)) { FetchGroup fetchGroupInSrc = ((FetchGroupTracker)cachedObject)._persistence_getFetchGroup(); FetchGroup fetchGroupInTarg = ((FetchGroupTracker)clone)._persistence_getFetchGroup(); //if the target fetch group is not null (i.e. fully fetched object) or if partially fetched, it's not a superset of that of the source, //or if refresh is required, should always write (either refresh or revert) data from the cache to the clones. return fetchGroupInTarg != null || fetchGroupInTarg.isSupersetOf(fetchGroupInSrc) || ((FetchGroupTracker) cachedObject)._persistence_shouldRefreshFetchGroup(); } return false; } Should be: public boolean shouldWriteInto(Object cachedObject, Object clone) { FetchGroup fetchGroupInTarg = ((FetchGroupTracker)clone)._persistence_getFetchGroup(); if (fetchGroupInTarg != null) { FetchGroup fetchGroupInSrc = ((FetchGroupTracker)cachedObject)._persistence_getFetchGroup(); //should write if target's fetch group is not a superset of that of the source, //or if refresh is required, should always write (either refresh or revert) data from the cache to the clones. return !fetchGroupInTarg.isSupersetOf(fetchGroupInSrc) || ((FetchGroupTracker) cachedObject)._persistence_shouldRefreshFetchGroup(); } return false; } Note that if (isPartialObject(clone)) { is identical to if (fetchGroupInTarg != null) {