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