Hi folks. Has anyone had difficulties using scrollable result sets when the results sets are large? I'm hoping it's a simple configuration issue or coding problem.

I'm fronting this with Hibernate so it's possible it's doing something bad... I'm investigating the ScrollableResultsImpl.java calls, but from the trace it looks like the problem is somewhere in Derby. Interestingly enough this works for small result sets.

Here's my simplified code and the corresponding exception. Any help would be greatly appreciated!

Criteria query = ...
query.setMaxResults(pageSize);
query.setFetchSize(pageSize);

try {
   ScrollableResults results = query.scroll(ScrollMode.SCROLL_INSENSITIVE);
   if(results != null) {
   //results.afterLast();
   while(results.next()){
       System.out.println("get(0) = " +results.get(0));
   }
} catch (Exception e) {
   e.printStackTrace();
}

org.hibernate.exception.GenericJDBCException: could not advance using next()
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52) at org.hibernate.impl.ScrollableResultsImpl.next(ScrollableResultsImpl.java:127)
   <clipped... removed my private classes from trace>
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
   at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ001, SQLERRMC: java.lang.StackOverflowErrorXJ001.U at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
   at org.apache.derby.client.am.ResultSet.next(Unknown Source)
at com.mchange.v2.c3p0.impl.NewProxyResultSet.next(NewProxyResultSet.java:2859) at org.hibernate.impl.ScrollableResultsImpl.next(ScrollableResultsImpl.java:122)
   ... 11 more
Caused by: org.apache.derby.client.am.SqlException: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ001, SQLERRMC: java.lang.StackOverflowErrorXJ001.U
   at org.apache.derby.client.am.ResultSet.completeSqlca(Unknown Source)
at org.apache.derby.client.net.NetResultSetReply.parseFetchError(Unknown Source) at org.apache.derby.client.net.NetResultSetReply.parseCNTQRYreply(Unknown Source) at org.apache.derby.client.net.NetResultSetReply.readPositioningFetch(Unknown Source) at org.apache.derby.client.net.ResultSetReply.readPositioningFetch(Unknown Source) at org.apache.derby.client.net.NetResultSet.readPositioningFetch_(Unknown Source)
   at org.apache.derby.client.am.ResultSet.getRowCount(Unknown Source)
at org.apache.derby.client.am.ResultSet.resultSetContainsNoRows(Unknown Source)
   at org.apache.derby.client.am.ResultSet.getNextRowset(Unknown Source)
   at org.apache.derby.client.am.ResultSet.nextX(Unknown Source)
   ... 14 more

Thanks,
JW

Reply via email to