| Summary: | conform in unit of work queries return subclasses when read subclasses not enabled | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | john.vandale | ||||||
| Component: | Eclipselink | Assignee: | David Minsky <david.minsky> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | Project Inbox <eclipselink.foundation-inbox> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | david.minsky, john.vandale, peter.krogh, tom.ware, tor.jarnbjo.ext | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
john.vandale
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 |