org.hibernate.exception.GenericJDBCException: could not execute query using iterate

Hibernate JIRA | Frederic Leitenberger | 1 decade ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    When using iterate and NOT iterating through all items, the cursor stays open. When repeating this several times the "maximum open cursors exceeded" - exception occurs. This problem occured in the following situation: We have an import tool, which reads one line from an import-file and queries the database for colliding/overlapping objects. The objects are loaded whit iterate. The first object which doesn't fit the new input throws an exception and so leaves the iterate-loop. There is no function to close the iterator explicitly. This would solve the problem (once the developer is aware of it). My current workaround ist to use query.list().iterator() instead of query.iterate(). But this is only applicable with small resultsets. I'll do an update of Hibernate soon and see if it still occurs. The attached test crashes after 300 iterations. 300 is the open cursor limit for my DB. org.hibernate.exception.GenericJDBCException: could not execute query using iterate 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.loader.hql.QueryLoader.iterate(QueryLoader.java:420) at org.hibernate.hql.ast.QueryTranslatorImpl.iterate(QueryTranslatorImpl.java:318) at org.hibernate.engine.query.HQLQueryPlan.performIterate(HQLQueryPlan.java:177) at org.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1177) at org.hibernate.impl.QueryImpl.iterate(QueryImpl.java:46) at de.iccs.test.HibernateAbortIterateTest.testAbortIterate(HibernateAbortIterateTest.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: java.sql.SQLException: ORA-01000: maximum open cursors exceeded at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272) at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623) at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181) at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:420) at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:896) at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:452) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:986) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2888) at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:2929) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139) at org.hibernate.loader.Loader.getResultSet(Loader.java:1669) at org.hibernate.loader.hql.QueryLoader.iterate(QueryLoader.java:397) ... 20 more

    Hibernate JIRA | 1 decade ago | Frederic Leitenberger
    org.hibernate.exception.GenericJDBCException: could not execute query using iterate
  2. 0

    When using iterate and NOT iterating through all items, the cursor stays open. When repeating this several times the "maximum open cursors exceeded" - exception occurs. This problem occured in the following situation: We have an import tool, which reads one line from an import-file and queries the database for colliding/overlapping objects. The objects are loaded whit iterate. The first object which doesn't fit the new input throws an exception and so leaves the iterate-loop. There is no function to close the iterator explicitly. This would solve the problem (once the developer is aware of it). My current workaround ist to use query.list().iterator() instead of query.iterate(). But this is only applicable with small resultsets. I'll do an update of Hibernate soon and see if it still occurs. The attached test crashes after 300 iterations. 300 is the open cursor limit for my DB. org.hibernate.exception.GenericJDBCException: could not execute query using iterate 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.loader.hql.QueryLoader.iterate(QueryLoader.java:420) at org.hibernate.hql.ast.QueryTranslatorImpl.iterate(QueryTranslatorImpl.java:318) at org.hibernate.engine.query.HQLQueryPlan.performIterate(HQLQueryPlan.java:177) at org.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1177) at org.hibernate.impl.QueryImpl.iterate(QueryImpl.java:46) at de.iccs.test.HibernateAbortIterateTest.testAbortIterate(HibernateAbortIterateTest.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: java.sql.SQLException: ORA-01000: maximum open cursors exceeded at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272) at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623) at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181) at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:420) at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:896) at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:452) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:986) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2888) at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:2929) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139) at org.hibernate.loader.Loader.getResultSet(Loader.java:1669) at org.hibernate.loader.hql.QueryLoader.iterate(QueryLoader.java:397) ... 20 more

    Hibernate JIRA | 1 decade ago | Frederic Leitenberger
    org.hibernate.exception.GenericJDBCException: could not execute query using iterate
  3. 0

    difference between releasing session and closing connection in hibernate ?

    Coderanch | 4 years ago | raj chopra
    java.sql.SQLException: ORA-01000: maximum open cursors exceeded
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    OraFAQ Forum: JDeveloper, Java & XML ยป ORA-01000: maximum open cursors exceeded

    orafaq.com | 2 years ago
    java.sql.SQLException: ORA-01000: maximum open cursors exceeded

    12 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.sql.SQLException

      ORA-01000: maximum open cursors exceeded

      at oracle.jdbc.driver.DatabaseError.throwSqlException()
    2. Oracle jdbc
      OraclePreparedStatement.executeQuery
      1. oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
      2. oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
      3. oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
      4. oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
      5. oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
      6. oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:420)
      7. oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:896)
      8. oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:452)
      9. oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:986)
      10. oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2888)
      11. oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:2929)
      11 frames
    3. Hibernate
      QueryLoader.iterate
      1. org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
      2. org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
      3. org.hibernate.loader.hql.QueryLoader.iterate(QueryLoader.java:397)
      3 frames
    4. Hibernate HQL/JP-QL Parser
      QueryTranslatorImpl.iterate
      1. org.hibernate.hql.ast.QueryTranslatorImpl.iterate(QueryTranslatorImpl.java:318)
      1 frame
    5. Hibernate
      QueryImpl.iterate
      1. org.hibernate.engine.query.HQLQueryPlan.performIterate(HQLQueryPlan.java:177)
      2. org.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1177)
      3. org.hibernate.impl.QueryImpl.iterate(QueryImpl.java:46)
      3 frames
    6. de.iccs.test
      HibernateAbortIterateTest.testAbortIterate
      1. de.iccs.test.HibernateAbortIterateTest.testAbortIterate(HibernateAbortIterateTest.java:55)
      1 frame
    7. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:585)
      4 frames
    8. JUnit
      TestSuite.run
      1. junit.framework.TestCase.runTest(TestCase.java:154)
      2. junit.framework.TestCase.runBare(TestCase.java:127)
      3. junit.framework.TestResult$1.protect(TestResult.java:106)
      4. junit.framework.TestResult.runProtected(TestResult.java:124)
      5. junit.framework.TestResult.run(TestResult.java:109)
      6. junit.framework.TestCase.run(TestCase.java:118)
      7. junit.framework.TestSuite.runTest(TestSuite.java:208)
      8. junit.framework.TestSuite.run(TestSuite.java:203)
      8 frames
    9. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      3 frames