Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Scrollable ResultSet Exception "End of Stream"(Scrollable ResultSet Example)
Scrollable ResultSet Exception "End of Stream" [message #1023638] Sun, 24 March 2013 20:17 Go to next message
Scott Selvia is currently offline Scott SelviaFriend
Messages: 8
Registered: April 2010
Junior Member
I'm getting a Exception Description: An attempt to read beyond the end of stream occurred. Trying to read a resultset using a scrollable cursor. I could not get the eclipselink example working using my entity:

Query query = em.createQuery("SELECT e FROM Employee e ORDER BY e.lastName ASC, e.firstName ASC");
query.setHint("eclipselink.cursor.scrollable", true);
ScrollableCursor scrollableCursor = (ScrollableCursor)query.getSingleResult();
List<Employee> emps = scrollableCursor.next(10);

Here is my code:

Query query = this.dbConn.createQuery("SELECT o FROM OrderSuppressionRecords o");
query.setHint("eclipselink.cursor.scrollable", true);
ScrollableCursor cursor = (ScrollableCursor)query.getSingleResult();

while (cursor.hasNext() == false)
{
OrderSuppressionRecords record = (OrderSuppressionRecords)cursor.next();
... Other Processing Code
}

Is there a good example that works with EclipseLink 2.3.2?

[Updated on: Sun, 24 March 2013 20:46]

Report message to a moderator

Re: Scrollable ResultSet Exception "End of Stream" [message #1023932 is a reply to message #1023638] Mon, 25 March 2013 13:39 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1039
Registered: July 2009
Senior Member
Just looking at your code, while (cursor.hasNext() == false) is incorrect as you want to only go through the loop when it is true.

Assuming this is a cut and paste error, check the size first by issuing a "SELECT COUNT(o) FROM OrderSuppressionRecords o" first and keep track of how many results you process before you get a problem.

Best Regards,
Chris
Previous Topic:@XmlInverseReference back pointer not set on unmarshalling
Next Topic:Batch fetch for type IN results in sql exception
Goto Forum:
  


Current Time: Sat Dec 20 08:16:25 GMT 2014

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

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