Announcement Announcement Module
No announcement yet.
HibernateCursorItemReader - scrollable result sets are not enabled Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • HibernateCursorItemReader - scrollable result sets are not enabled


    I have a Spring Batch job, which uses HibernateCursorItemReader for reading some items from SQL Server 2008 database. The job has worked fine in unit & integration tests and in test environment. After I included the job as a part of larger Batch process group as a last job in the group queue, it gives me an exception:

    2011-02-01 06:36:20 ERROR  an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
    org.hibernate.AssertionFailure: scrollable result sets are not enabled
    	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(
    	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(
    	at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(
    	at org.hibernate.loader.Loader.prepareQueryStatement(
    	at org.hibernate.loader.Loader.scroll(
    	at org.hibernate.loader.hql.QueryLoader.scroll(
    	at org.hibernate.hql.ast.QueryTranslatorImpl.scroll(
    	at org.hibernate.engine.query.HQLQueryPlan.performScroll(
    	at org.hibernate.impl.StatelessSessionImpl.scroll(
    	at org.hibernate.impl.QueryImpl.scroll(
    	at org.springframework.batch.item.database.HibernateItemReaderHelper.getForwardOnlyCursor(
    	at org.springframework.batch.item.database.HibernateCursorItemReader.doOpen(
    If I boot my Tomcat and run the job again, everything works fine. So it seems, that in some cases Hibernate session, or perhaps a transaction gets stuck somehow? Any idea of this?

    I am using Spring Batch 2.1.5.RELEASE and Hibernate 3.2.0.cr4.

  • #2
    What DataSource are you using? Maybe there's a problem with its pooling.


    • #3
      Thanks for answering. I`m using Commons BasicDatasource. You might be right, it could be datasource pooling problem.

      But, I haven`t been able to repet this problem again, everything has worked fine with my nightly batch processes in past three nights. I will re-post here, if I can somehow repeat the problem with more details. Hopefully nothing will come up.