java.sql.SQLException: ResultSet.next was not called

Hibernate JIRA | Malcolm Green | 1 decade ago
  1. 0

    Trying to use the SelectGenerator as Primary ID of record is populated via a trigger and getting the following error. java.lang.String java.lang.ClassCastException: java.lang.String at org.hibernate.type.LongType.set(LongType.java:40) at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:62) at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:44) at org.hibernate.id.SelectGenerator.bindParameters(SelectGenerator.java:51) at org.hibernate.id.AbstractPostInsertGenerator.getGenerated(AbstractPostInsertGenerator.java:41) at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1755) at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2149) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:34) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:238) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:158) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:104) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:429) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:424) .......... I narrowed this down to the fact that the code assumes that the uniqueKeyPropertyType is the same type as the ID. I personally think that this is slightly restrictive and so have amended the code accordingly. ............. The next thrown exception is as follows: java.sql.SQLException: ResultSet.next was not called at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269) at oracle.jdbc.driver.OracleStatement.prepare_for_new_get(OracleStatement.java:3202) at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:4341) at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:529) at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1540) at org.hibernate.type.LongType.get(LongType.java:26) at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:77) at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:68) at org.hibernate.id.SelectGenerator.getResult(SelectGenerator.java:57) at org.hibernate.id.AbstractPostInsertGenerator.getGenerated(AbstractPostInsertGenerator.java:44) at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1755) at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2149) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:34) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:238) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:158) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:104) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:429) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:424) at hsbc.greaterniku.model.RITFTest.testCreateRITF(RITFTest.java:56) 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.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:289) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:656) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:558) .................. Obviously this is because ResultSet.next isn't being called ;-) I have amended the code again but am not totally convinced that I have put the rs.next() call in the correct place. Please accept my apologies if I have not posted this in the correct way, but this is the first time I have contributed to an Opensource project.

    Hibernate JIRA | 1 decade ago | Malcolm Green
    java.sql.SQLException: ResultSet.next was not called
  2. 0

    Trying to use the SelectGenerator as Primary ID of record is populated via a trigger and getting the following error. java.lang.String java.lang.ClassCastException: java.lang.String at org.hibernate.type.LongType.set(LongType.java:40) at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:62) at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:44) at org.hibernate.id.SelectGenerator.bindParameters(SelectGenerator.java:51) at org.hibernate.id.AbstractPostInsertGenerator.getGenerated(AbstractPostInsertGenerator.java:41) at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1755) at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2149) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:34) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:238) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:158) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:104) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:429) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:424) .......... I narrowed this down to the fact that the code assumes that the uniqueKeyPropertyType is the same type as the ID. I personally think that this is slightly restrictive and so have amended the code accordingly. ............. The next thrown exception is as follows: java.sql.SQLException: ResultSet.next was not called at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269) at oracle.jdbc.driver.OracleStatement.prepare_for_new_get(OracleStatement.java:3202) at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:4341) at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:529) at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1540) at org.hibernate.type.LongType.get(LongType.java:26) at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:77) at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:68) at org.hibernate.id.SelectGenerator.getResult(SelectGenerator.java:57) at org.hibernate.id.AbstractPostInsertGenerator.getGenerated(AbstractPostInsertGenerator.java:44) at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1755) at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2149) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:34) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:238) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:158) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:104) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:429) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:424) at hsbc.greaterniku.model.RITFTest.testCreateRITF(RITFTest.java:56) 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.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:289) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:656) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:558) .................. Obviously this is because ResultSet.next isn't being called ;-) I have amended the code again but am not totally convinced that I have put the rs.next() call in the correct place. Please accept my apologies if I have not posted this in the correct way, but this is the first time I have contributed to an Opensource project.

    Hibernate JIRA | 1 decade ago | Malcolm Green
    java.sql.SQLException: ResultSet.next was not called
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    DB Adapter Publish not working with Oracle Database 7.0

    Oracle Community | 1 decade ago | 429908
    java.sql.SQLException: Fallo al convertir a representación interna
  5. 0

    DB Adapter Publish not working with Oracle Database 7.0

    Oracle Community | 1 decade ago | 429908
    java.sql.SQLException: Fallo al convertir a representación interna

    26 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

      ResultSet.next was not called

      at oracle.jdbc.dbaccess.DBError.throwSqlException()
    2. oracle.jdbc.dbaccess
      DBError.throwSqlException
      1. oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
      2. oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
      3. oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
      3 frames
    3. Oracle jdbc
      OracleResultSet.getLong
      1. oracle.jdbc.driver.OracleStatement.prepare_for_new_get(OracleStatement.java:3202)
      2. oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:4341)
      3. oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:529)
      4. oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1540)
      4 frames
    4. Hibernate
      BasicEntityPersister.insert
      1. org.hibernate.type.LongType.get(LongType.java:26)
      2. org.hibernate.type.NullableType.nullSafeGet(NullableType.java:77)
      3. org.hibernate.type.NullableType.nullSafeGet(NullableType.java:68)
      4. org.hibernate.id.SelectGenerator.getResult(SelectGenerator.java:57)
      5. org.hibernate.id.AbstractPostInsertGenerator.getGenerated(AbstractPostInsertGenerator.java:44)
      6. org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1755)
      7. org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2149)
      7 frames
    5. Hibernate
      EntityIdentityInsertAction.execute
      1. org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:34)
      1 frame
    6. Hibernate
      ActionQueue.execute
      1. org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
      1 frame
    7. Hibernate
      SessionImpl.save
      1. org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:238)
      2. org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:158)
      3. org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:104)
      4. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
      5. org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
      6. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
      7. org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
      8. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
      9. org.hibernate.impl.SessionImpl.save(SessionImpl.java:429)
      10. org.hibernate.impl.SessionImpl.save(SessionImpl.java:424)
      10 frames
    8. hsbc.greaterniku.model
      RITFTest.testCreateRITF
      1. hsbc.greaterniku.model.RITFTest.testCreateRITF(RITFTest.java:56)
      1 frame
    9. 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
    10. 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
    11. Apache Ant + JUnit
      JUnitTestRunner.main
      1. org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:289)
      2. org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:656)
      3. org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:558)
      3 frames