Results 1 to 3 of 3

Thread: HibernateCursorItemReader - scrollable result sets are not enabled

  1. #1

    Default HibernateCursorItemReader - scrollable result sets are not enabled

    Hi,

    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:

    Code:
    2011-02-01 06:36:20 ERROR AssertionFailure.java:22  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(AbstractBatcher.java:475)
    	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:423)
    	at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
    	at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
    	at org.hibernate.loader.Loader.scroll(Loader.java:2285)
    	at org.hibernate.loader.hql.QueryLoader.scroll(QueryLoader.java:441)
    	at org.hibernate.hql.ast.QueryTranslatorImpl.scroll(QueryTranslatorImpl.java:390)
    	at org.hibernate.engine.query.HQLQueryPlan.performScroll(HQLQueryPlan.java:245)
    	at org.hibernate.impl.StatelessSessionImpl.scroll(StatelessSessionImpl.java:586)
    	at org.hibernate.impl.QueryImpl.scroll(QueryImpl.java:67)
    	at org.springframework.batch.item.database.HibernateItemReaderHelper.getForwardOnlyCursor(HibernateItemReaderHelper.java:126)
    	at org.springframework.batch.item.database.HibernateCursorItemReader.doOpen(HibernateCursorItemReader.java:183)
    	at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open(AbstractItemCountingItemStreamItemReader.java:134)
    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. #2
    Join Date
    Jun 2005
    Posts
    4,232

    Default

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

  3. #3

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •