Bug 406493 - BatchFetchType.IN object building fails when the relationship being populated has JOIN read relationships with filtered duplicates.
Summary: BatchFetchType.IN object building fails when the relationship being populated...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X
: P2 normal with 7 votes (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-24 17:21 EDT by Michael Nielson CLA
Modified: 2022-06-09 10:24 EDT (History)
1 user (show)

See Also:


Attachments
skip nulls in CollectionMapping (2.01 KB, patch)
2013-05-09 14:15 EDT, Michael Nielson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Nielson CLA 2013-04-24 17:21:34 EDT
With this object graph:

RootObject
  -> List<OtherObj>

OtherObj
  -> List<MoreObj> FetchType.EAGER -> JOIN

MoreObj

Root object has a list of OtherObjs, OtherObjs has MoreObjs, the MoreObjs relationship is eagerly fetched with a join.

When RootObj is queried with a batch read for OtherObjs and BatchFetchType.IN  (this may affect JOIN, and EXISTS too) CollectionMapping.executeBatchQuery throws a null pointer exception inside of: extractKeyFromTargetRow(row, session).

The null items should be filtered out of what is placed in ComplexQueryResult.getData, or the null should be checked when iterating over the ComplexQueryResult.

java.lang.NullPointerException
	at org.eclipse.persistence.mappings.OneToManyMapping.extractKeyFromTargetRow(OneToManyMapping.java:327)
	at org.eclipse.persistence.mappings.CollectionMapping.executeBatchQuery(CollectionMapping.java:918)
	at org.eclipse.persistence.mappings.ForeignReferenceMapping.extractResultFromBatchQuery(ForeignReferenceMapping.java:579)
	at org.eclipse.persistence.mappings.CollectionMapping.extractResultFromBatchQuery(CollectionMapping.java:864)
	at org.eclipse.persistence.internal.indirection.BatchValueHolder.instantiate(BatchValueHolder.java:58)
	at org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:88)
	at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:88)
Comment 1 Tom Ware CLA 2013-04-26 11:24:14 EDT
Does this still fail on 2.4.2?
Comment 2 Michael Nielson CLA 2013-04-26 12:45:38 EDT
(In reply to comment #1)
> Does this still fail on 2.4.2?

I took a look at current SVN and the logic in this code path hasn't changed/is still broken. 

CollectionMapping.executeBatchQuery does not handle nulls and the items in ComplexQueryResults.getData still contain nulls.
Comment 3 Tom Ware CLA 2013-05-09 09:16:48 EDT
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 4 Michael Nielson CLA 2013-05-09 14:15:57 EDT
Created attachment 230747 [details]
skip nulls in CollectionMapping
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:24:21 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink