I am having a problem accessing results of a query in an org.hibernate.ScrollableResults.
I create the query:
Code:
ScrollableResults list = em.getAllScrollable(Class.forName("com.fcl.greenfield." + formType));
System.out.println("\n\nGot ScrollableResults - calling first()...");
list.first();
And out comes:
Code:
11:44:35,468 INFO [ConnectionManager] forcing batcher resource cleanup on transaction completion; forgot to close ScrollableResults
/Iterator?
11:44:35,468 INFO [STDOUT]
Got ScrollableResults - calling first()...
11:44:35,468 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
11:44:35,468 ERROR [JDBCExceptionReporter] The result set is closed.
11:44:35,468 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
org.hibernate.exception.GenericJDBCException: could not advance using first()
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.impl.ScrollableResultsImpl.first(ScrollableResultsImpl.java:68)
at org.apache.jsp.form.Lister_jsp._jspService(org.apache.jsp.form.Lister_jsp:71)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:514)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: The result set is closed.
at org.jboss.resource.adapter.jdbc.WrappedResultSet.checkState(WrappedResultSet.java:1937)
at org.jboss.resource.adapter.jdbc.WrappedResultSet.first(WrappedResultSet.java:213)
at org.hibernate.impl.ScrollableResultsImpl.first(ScrollableResultsImpl.java:63)
... 27 more
What's wrong? It appears that using a ScrollableResults from the Query.scroll() method is broken!