Community
Participate
Working Groups
Build Identifier: ReadAllQuery and ReadObjectQuery with conformResultsInUnitOfWork set will return subclasses of the query class type if instances of those subclasses are registered in the UoW despite the descriptor indication not to read subclasses. For example with ReadAllQuery the return set includes only the query class type instances from the DB but the query class and subclass type instances from the UoW. Reproducible: Always
Created attachment 180981 [details] fix and testcase
Created attachment 181333 [details] fix and testcase which incorporates review comments
Initial checkin done in r8380: https://fisheye2.atlassian.com/changelog/eclipselink/?cs=8380 Corrected checkin done in r8409: https://fisheye2.atlassian.com/changelog/eclipselink/?cs=8409
Please reopen. The fix does not work properly if interface aliases are configured for the persistent classes. Consider e.g. the classes A and B with "B extends A" and their interface aliases IA and IB. If I make a query for IB and an instance of B is found, the following expression in IdentityMapManager evaluates to false: boolean readSubclassesOrNoInheritance = (!descriptor.hasInheritance() || descriptor.getInheritancePolicy().shouldReadSubclasses()); descriptor is here the class descriptor of B, which: - hasInheritance() is true, since an InheritancePolicy instance is available - shouldReadSubclasses() is false, since there are no further subclasses of B Later in the same method, readSubclassesOrNoInheritance is used like this: if ((object.getClass() == theClass) || (readSubclassesOrNoInheritance && (theClass.isInstance(object)))) { We now have the issues that object.getClass() returns B.class, while theClass is IB.class. Since readSubclassesOrNoInheritance is false, the isInstance check (IB.class.isInstance(B.class) would have evaluated to true) does not cover the interface alias, as it did before this fix was applied.
Please file a new bug including specifics about how to recreate, or how to alter the test case supplied with the fix for this bug to recreate the issue you are seeing.
I can't find a download for the test framework, so it's a little bit difficult to write a new test case. I've however created bug 354822 and hope that the description is adequate.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink