Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » NullPointerException in eclipselink 2.1.2 code : JoinedAttributeManager.java(NullPointerException in eclipselink 2.1.2 code : JoinedAttributeManager.java)
NullPointerException in eclipselink 2.1.2 code : JoinedAttributeManager.java [message #653161] Tue, 08 February 2011 17:39 Go to next message
jean marie turc is currently offline jean marie turcFriend
Messages: 6
Registered: January 2011
Junior Member
I want to use a cursor, so I try this:
Query query = em.createQuery(sql);
		query.setHint("eclipselink.cursor.scrollable", true);
		ScrollableCursor scrollableCursor = (ScrollableCursor) query.getSingleResult();
		boolean loop = true;
		while (loop) {
			List<Object> emps = scrollableCursor.next(100);
			if (emps == null || emps.size() == 0)
				loop = false;
		}


Before the end of the loop , I have this
java.lang.NullPointerException
	at org.eclipse.persistence.internal.queries.JoinedAttributeManager.processDataResults(JoinedAttributeManager.java:1074)
	at org.eclipse.persistence.queries.ScrollableCursor.retrieveNextObject(ScrollableCursor.java:557)
	at org.eclipse.persistence.queries.ScrollableCursor.loadNext(ScrollableCursor.java:397)
	at org.eclipse.persistence.queries.ScrollableCursor.next(ScrollableCursor.java:423)
	at org.eclipse.persistence.queries.ScrollableCursor.next(ScrollableCursor.java:445)



The code of the classe JoinedAttributeManager is :
 public AbstractRecord processDataResults(AbstractRecord row, Cursor cursor, boolean forward) {
        if (this.dataResultsByPrimaryKey == null) {
            this.dataResultsByPrimaryKey = new HashMap();
        }
        AbstractRecord parentRow = row;
        List<AbstractRecord> childRows = new ArrayList<AbstractRecord>();
        childRows.add(row);
        int parentIndex = getParentResultIndex();
        // Must adjust for the parent index to ensure the correct pk is extracted.
        Vector trimedFields = new NonSynchronizedSubVector(row.getFields(), parentIndex, row.size());
.....


and the nullpointer exception is on line 1074 , so;
 Vector trimedFields = new NonSynchronizedSubVector(row.getFields(), parentIndex, row.size());

because the variable row is null

I think is is a bug,
no ?

Thanks
Re: NullPointerException in eclipselink 2.1.2 code : JoinedAttributeManager.java [message #653351 is a reply to message #653161] Wed, 09 February 2011 13:44 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1039
Registered: July 2009
Senior Member
Hello,

Please file a bug for this issue. In the mean time, a workaround is to not use fetch joins for OneToMany relationships on results with a scrollable cursor.

Best Regards,
Chris
Previous Topic:deadlock on select
Next Topic:EclipseLink translating # to ? in native query
Goto Forum:
  


Current Time: Thu Nov 27 16:21:22 GMT 2014

Powered by FUDForum. Page generated in 0.04897 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software