[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-7068) "Cursor state not valid" error from AS400

Nelson Rodrigues (JIRA) noreply at atlassian.com
Thu Mar 22 12:55:49 EDT 2012


    [ https://hibernate.onjira.com/browse/HHH-7068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46058#comment-46058 ] 

Nelson Rodrigues commented on HHH-7068:
---------------------------------------

I'm also seeing this exception ever since I've migrated my projects from 3.6.9 to 4.1.1.

Aparently hibernate is trying to absolutely position a TYPE_FORWARD_ONLY cursor, leading to this exception about invalid cursor state.

The faulty code seems to be a typo in org.hibernate.loader.Loader.prepareQueryStatement (line 1703). It's calling the method org.hibernate.loader.Loader.getScrollMode with the variable useLimit instead of useLimitOffset, leading the getScrollMode method to believe the correct scroll mode to return is null (equivalent to FORWARD_ONLY), which is inconsistent with the Dialect's habilities.



> "Cursor state not valid" error from AS400
> -----------------------------------------
>
>                 Key: HHH-7068
>                 URL: https://hibernate.onjira.com/browse/HHH-7068
>             Project: Hibernate ORM
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 4.0.0.Final
>         Environment: -Hibernate version, shipped with AS 7.0.2 and 7.1.0RC1
> -Database AS400
>            Reporter: Alex Varakin
>
> 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 while running the actual query:
>  
> 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 AS 7.0.2 and Hibernate 3.6.9.
> I guess this is related to scrollable result set, it seems that Hibernate does not make result set as scrollable. 
>  

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list