-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Problem using ScrollableResults
PostPosted: Tue Apr 04, 2006 8:39 am 
Regular
Regular

Joined: Fri Jan 20, 2006 9:38 am
Posts: 61
Location: Notts, UK
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!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 10:14 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Read the documentation on ScrollableResults:

Quote:
The getCurrentSession() operation has one downside in a JTA environment. There is one caveat to the use of after_statement connection release mode, which is then used by default. Due to a silly limitation of the JTA spec, it is not possible for Hibernate to automatically clean up any unclosed ScrollableResults or Iterator instances returned by scroll() or iterate(). You must release the underlying database cursor by calling ScrollableResults.close() or Hibernate.close(Iterator) explicity from a finally block. (Of course, most applications can easily avoid using scroll() or iterate() at all from the JTA or CMT code.)


Handle them more carefully.[/code]


Top
 Profile  
 
 Post subject: Re: Problem using ScrollableResults
PostPosted: Tue Mar 08, 2011 2:40 am 
Newbie

Joined: Thu Feb 17, 2011 3:03 am
Posts: 2
but how???
I am doing

Query cacheQuery = cacheSession.createQuery(queryStr);
ScrollableResults cacheResults = cacheQuery.scroll(ScrollMode.SCROLL_INSENSITIVE);

cacheResults.scroll(0);

This above line throws following error :
Caused by: could not advance using scroll()

For more information : I am using MSSQL as database backednd storage.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.