Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Null Pointer Exception when using Scrollable Cursor on a OneToMany Mapping

Thanks for your help Chris!
Filed bug 351509

Rohit

On 7/7/2011 11:49 PM, Christopher Delahunt wrote:
Hello Rohit,

Looks like the problem occurs because code to process the join was added before the null check, resulting in an NPE when calling hasNext after the last row is fetched. 
Please file a bug for this.  As you mentioned, this will only occur when using a scrollable cursor and joining on a oneToMany or ManyToMany mapping.  You can either avoid this combination,
or avoid calling hasNext after the last row is fetched - possibly by determing the size to be returned before hand by issuing a count query. 

Best Regards,
Chris



On 07/07/2011 12:49 PM, Rohit Banga wrote:
Hi Chris
I will rerun the code once I get back to my development machine.
For the other questions, if I do not invoke useScrollableCursor() then it works fine. I get a list of DynamicEntities on which I can iterate to get the data. It does go through some calls successfully before throwing the exception. I have not been able to establish a pattern yet by varying the page size. But it happens only with the OneToManyMapping. I will also send you the schema dump to you so you can execute the code if needed. I just have an employee and a phone table with few entries.
Thanks
Rohit

----- Original Message -----
From: christopher.delahunt@xxxxxxxxxx
To: rohit.banga@xxxxxxxxxx, eclipselink-users@xxxxxxxxxxx
Sent: Thursday, July 7, 2011 9:33:13 PM GMT +05:30 Chennai, Kolkata, Mumbai, New Delhi
Subject: Re: [eclipselink-users] Null Pointer Exception when using Scrollable Cursor on a OneToMany Mapping

Hello Rohit,

The line number might be off in my view; it shows that the row might be null and I am not sure what could cause that without an exception or problem occuring in the query. 
Can you send the log just showing the query and the exception with logging set to finest?  Does it go through any iterations before the exception occurs, or is it the fist call to hasNext that throws the exception?
Can you also check the results from executing the generated SQL manually?

Best Regards,
Chris

On 07/07/2011 3:17 AM, Rohit Banga wrote:
Hi All

I am getting a NullPointerException when trying to execute a ReadAllQuery with scrollable cursor enabled. It seems that the exception happens when it tries to access the many side of the mapping.
I am using Eclipselink-2.3. Here is the stack trace:

Exception in thread "main" 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.hasNext(ScrollableCursor.java:263)
    at
ScrollableCursorTest.main(ScrollableCursorTest.java:80)

I have attached the sample code along with this mail. Can someone please have a look at it and see what is amiss?
Thanks in Advance!

--
Thanks and Regards
Rohit Banga
Member Technical Staff
Oracle Server Technologies

_______________________________________________ eclipselink-users mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users

--
Thanks and Regards
Rohit Banga
Member Technical Staff
Oracle Server Technologies

Back to the top