java.sql.SQLException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • The declaration of collection, when tables with composite ids are involved, is imho a bit too complex and error prone. Consider this scenario, regarding an online store. For semplicity, I used object with only pk. OrderLine OrderLineItem OrderLineItemOption --------- ------------- ------------------- PK: orderId(CHAR) <-> PK: orderId(CHAR) <-> PK: orderId(CHAR) PK: line(INT) <-----> PK: line(INT) <-----> PK: line(INT) PK: itemId(CHAR) <--> PK: itemId(CHAR) PK: optionId(CHAR) When declaring two-way relations, it's not clear the order to be used for the fk-table columns. For example, in OrderLine.hbm.xml : <list name="orderLineItemList" lazy="true" inverse="true"> <key> <column name="ORDERID"/> <column name="LINE"/> </key> <index column="ITEMID" /> <one-to-many class="hibernate.test.OrderLineItem" /> </list> seems correct, but Hibernate generates the following error (with some debug info): 15:42:15,230 DEBUG SQL:226 - select orderline0_.ORDERID as ORDERID0_, orderline0_.LINE as LINE0_ from ORDERLINE orderline0_ where orderline0_.ORDERID=? and orderline0_.LINE=? 15:42:15,267 DEBUG StringType:46 - binding 'A1 ' to parameter: 1 15:42:15,270 DEBUG IntegerType:46 - binding '1' to parameter: 2 orderLine = hibernate.test.OrderLine@1abf87[comp_id=hibernate.test.OrderLinePK@273f4e[orderId=A1 ,line=1]] 15:42:15,397 DEBUG SQL:226 - select orderlinei0_.ORDERID as ORDERID__, orderlinei0_.LINE as LINE__, orderlinei0_.ITEMID as ITEMID__, orderlinei0_.ORDERID as ORDERID0_, orderlinei0_.LINE as LINE0_, orderlinei0_.ITEMID as ITEMID0_ from ORDERLINEITEM orderlinei0_ where orderlinei0_.ORDERID=? and orderlinei0_.LINE=? 15:42:15,400 DEBUG StringType:46 - binding 'A1 ' to parameter: 1 15:42:15,403 DEBUG IntegerType:46 - binding '1' to parameter: 2 15:42:15,438 DEBUG StringType:68 - returning 'A1 ' as column: ORDERID0_ 15:42:15,441 DEBUG IntegerType:68 - returning '1' as column: LINE0_ 15:42:15,444 DEBUG StringType:68 - returning 'AA111 ' as column: ITEMID0_ 15:42:15,450 DEBUG StringType:68 - returning 'A1 ' as column: ORDERID__ 15:42:15,452 DEBUG IntegerType:68 - returning '1' as column: LINE__ 15:42:15,455 DEBUG StringType:68 - returning 'A1 ' as column: ORDERID__ 15:42:15,458 DEBUG IntegerType:68 - returning '1' as column: LINE__ 15:42:15,461 DEBUG StringType:68 - returning 'AA111 ' as column: ITEMID__ 15:42:15,579 WARN JDBCExceptionReporter:38 - SQL Error: 17059, SQLState: null 15:42:15,581 ERROR JDBCExceptionReporter:46 - Fail to convert to internal representation 15:42:15,594 WARN JDBCExceptionReporter:38 - SQL Error: 17059, SQLState: null 15:42:15,596 ERROR JDBCExceptionReporter:46 - Fail to convert to internal representation 15:42:15,599 ERROR JDBCExceptionReporter:38 - could not initialize collection: [hibernate.test.OrderLine.orderLineItemList#hibernate.test.OrderLinePK@273f4e[orderId=A1 ,line=1]] java.sql.SQLException: Fail to convert to internal representation at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java) at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java) at oracle.jdbc.driver.OracleStatement.getIntValue(OracleStatement.java) at oracle.jdbc.driver.OracleResultSetImpl.getInt(OracleResultSetImpl.java) at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java) [snip] It is also a bit strange that the generated query for lazy initialization for the list has duplicate columns, generating unecessary data fetch.
    via by Marco Papini,
  • The declaration of collection, when tables with composite ids are involved, is imho a bit too complex and error prone. Consider this scenario, regarding an online store. For semplicity, I used object with only pk. OrderLine OrderLineItem OrderLineItemOption --------- ------------- ------------------- PK: orderId(CHAR) <-> PK: orderId(CHAR) <-> PK: orderId(CHAR) PK: line(INT) <-----> PK: line(INT) <-----> PK: line(INT) PK: itemId(CHAR) <--> PK: itemId(CHAR) PK: optionId(CHAR) When declaring two-way relations, it's not clear the order to be used for the fk-table columns. For example, in OrderLine.hbm.xml : <list name="orderLineItemList" lazy="true" inverse="true"> <key> <column name="ORDERID"/> <column name="LINE"/> </key> <index column="ITEMID" /> <one-to-many class="hibernate.test.OrderLineItem" /> </list> seems correct, but Hibernate generates the following error (with some debug info): 15:42:15,230 DEBUG SQL:226 - select orderline0_.ORDERID as ORDERID0_, orderline0_.LINE as LINE0_ from ORDERLINE orderline0_ where orderline0_.ORDERID=? and orderline0_.LINE=? 15:42:15,267 DEBUG StringType:46 - binding 'A1 ' to parameter: 1 15:42:15,270 DEBUG IntegerType:46 - binding '1' to parameter: 2 orderLine = hibernate.test.OrderLine@1abf87[comp_id=hibernate.test.OrderLinePK@273f4e[orderId=A1 ,line=1]] 15:42:15,397 DEBUG SQL:226 - select orderlinei0_.ORDERID as ORDERID__, orderlinei0_.LINE as LINE__, orderlinei0_.ITEMID as ITEMID__, orderlinei0_.ORDERID as ORDERID0_, orderlinei0_.LINE as LINE0_, orderlinei0_.ITEMID as ITEMID0_ from ORDERLINEITEM orderlinei0_ where orderlinei0_.ORDERID=? and orderlinei0_.LINE=? 15:42:15,400 DEBUG StringType:46 - binding 'A1 ' to parameter: 1 15:42:15,403 DEBUG IntegerType:46 - binding '1' to parameter: 2 15:42:15,438 DEBUG StringType:68 - returning 'A1 ' as column: ORDERID0_ 15:42:15,441 DEBUG IntegerType:68 - returning '1' as column: LINE0_ 15:42:15,444 DEBUG StringType:68 - returning 'AA111 ' as column: ITEMID0_ 15:42:15,450 DEBUG StringType:68 - returning 'A1 ' as column: ORDERID__ 15:42:15,452 DEBUG IntegerType:68 - returning '1' as column: LINE__ 15:42:15,455 DEBUG StringType:68 - returning 'A1 ' as column: ORDERID__ 15:42:15,458 DEBUG IntegerType:68 - returning '1' as column: LINE__ 15:42:15,461 DEBUG StringType:68 - returning 'AA111 ' as column: ITEMID__ 15:42:15,579 WARN JDBCExceptionReporter:38 - SQL Error: 17059, SQLState: null 15:42:15,581 ERROR JDBCExceptionReporter:46 - Fail to convert to internal representation 15:42:15,594 WARN JDBCExceptionReporter:38 - SQL Error: 17059, SQLState: null 15:42:15,596 ERROR JDBCExceptionReporter:46 - Fail to convert to internal representation 15:42:15,599 ERROR JDBCExceptionReporter:38 - could not initialize collection: [hibernate.test.OrderLine.orderLineItemList#hibernate.test.OrderLinePK@273f4e[orderId=A1 ,line=1]] java.sql.SQLException: Fail to convert to internal representation at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java) at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java) at oracle.jdbc.driver.OracleStatement.getIntValue(OracleStatement.java) at oracle.jdbc.driver.OracleResultSetImpl.getInt(OracleResultSetImpl.java) at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java) [snip] It is also a bit strange that the generated query for lazy initialization for the list has duplicate columns, generating unecessary data fetch.
    via by Marco Papini,
  • Can't figure it out...: Exhausted ResultSet
    via by Unknown author,
  • Invalid column name Error.
    via by 595313,
  • Invalid column name Error.
    via by 843859,
  • Exhausted ResultSet
    via by 3004,
  • Exhausted ResultSet
    via by Babu,
  • New at JDBC
    via by 843854,
    • java.sql.SQLException: Fail to convert to internal representation at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java) at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java) at oracle.jdbc.driver.OracleStatement.getIntValue(OracleStatement.java) at oracle.jdbc.driver.OracleResultSetImpl.getInt(OracleResultSetImpl.java) at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java)

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor2 times, last one,
    rp
    1 times, last one,
    Unknown visitor1 times, last one,
    28 more bugmates