Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326977

Summary: Querying on manual query key defined for an aggregate fails
Product: z_Archived Reporter: David Minsky <david.minsky>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed fix and testcase
none
Proposed fix and testcase (with all files)
none
Fix and test with revised fix to QueryKeyExpression none

Description David Minsky CLA 2010-10-04 18:05:29 EDT
If you use a query-key defined for a field inside an aggregate then in-memory
querying does not work.  This can break conforming, in-memory querying and
update/delete-all invalidation.

This is because in conforming an expression if we can't find a mapping for
the query-key we try to find a mapping for the query-key's field.  This works
out ok for direct-mappings but if the mapping was inside an aggregate we find
the aggregate then end up comparing the aggregate object with the direct
value and think the object does not conform (or does if inside a not).


Needs to be fixed by only using the mapping for the field if the query-key
was a direct-query-key and if the mapping is a direct-mapping.

Also noticed the code in this method (QueryKeyExpression.valueFromCollection)
under,

// For bug 2780817 get the mapping directly from the object.  In EJB 2.0

Is wrong, as it uses the expression's name not the mapping's, which will
cause a null-pointer if the mapping was null (for query-key's field).
Comment 1 David Minsky CLA 2010-10-04 18:06:12 EDT
5934088
Comment 2 David Minsky CLA 2010-10-04 18:14:33 EDT
Created attachment 180214 [details]
Proposed fix and testcase
Comment 3 David Minsky CLA 2010-10-05 14:10:04 EDT
Created attachment 180269 [details]
Proposed fix and testcase (with all files)
Comment 4 David Minsky CLA 2010-10-20 13:39:31 EDT
Created attachment 181316 [details]
Fix and test with revised fix to QueryKeyExpression
Comment 5 David Minsky CLA 2010-10-20 16:43:39 EDT
Fixed in trunk revision: 8379
Reviewed: James Sutherland
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:18:42 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink