0 Replies Latest reply: Feb 12, 2012 1:06 AM by Alexander Varakin RSS

"Cursor state not valid" while paging through table

Alexander Varakin Newbie

Hi,

 

I am having a problem with an application which runs under AS 7.0.2 (7.1.0CR1 as well). It connects to database on AS400 using JPA interface and  is able to read data from table on AS400 starting from row 0, but if I specify starting row more than 0 using query.setFirstResult, then I am getting an exception:

 

Caused by: java.sql.SQLException: Cursor state not valid.

    at com.ibm.as400.access.JDError.createSQLExceptionSubClass(JDError.java:819)

    at com.ibm.as400.access.JDError.throwSQLException(JDError.java:411)

    at com.ibm.as400.access.JDError.throwSQLException(JDError.java:387)

    at com.ibm.as400.access.AS400JDBCResultSet.beforePositioning(AS400JDBCResultSet.java:1282)

    at com.ibm.as400.access.AS400JDBCResultSet.absolute(AS400JDBCResultSet.java:1086)

    at org.jboss.jca.adapters.jdbc.WrappedResultSet.absolute(WrappedResultSet.java:131)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_29]

    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_29]

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_29]

    at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_29]

    at org.hibernate.engine.jdbc.internal.proxy.AbstractResultSetProxyHandler.continueInvocation(AbstractResultSetProxyHandler.java:104) [hibernate-core-4.0.0.Final.jar:4.0.0.Final]

 

 

Same code works fine under Tomcat 7 and Hybernate 3.6.9.

I guess this is related to scrollable result set, it seems that Hibernate does not make result set as scrollable. Is there any way to make result set scrollable?

 

 

Would appreciate any help....

 

Alex