org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [SELECT * FROM USER WHERE EMAIL = ?]; Conversion not supported for type xxx.enums.Gender; nested exception is java.sql.SQLException: Conversion not supported for type xxx.enums.Gender

Spring JIRA | cemo koc | 2 years ago
  1. 0

    I have updated our codebase to spring 4.1 and had some problems. I am working with MySQL 5.6 and latest driver (5.1.32) and JDK8. The block below from JdbcUtils is throwing an exception at line `return rs.getObject(index, requiredType);` {code} if (getObjectWithTypeAvailable) { try { return rs.getObject(index, requiredType); } catch (SQLFeatureNotSupportedException ex) { logger.debug("JDBC driver does not support JDBC 4.1 'getObject(int, Class)' method", ex); } catch (AbstractMethodError err) { logger.debug("JDBC driver does not implement JDBC 4.1 'getObject(int, Class)' method", err); } } // Fall back to getObject without type specification... return getResultSetValue(rs, index); {code} I have also evaluated last statement which is working as expected. {code} return getResultSetValue(rs, index); {code} Here is the details: {code} ERROR [2014-09-10 12:44:55,993] com.clovify.lyso.guava.OptionalExtractorFactory: guava extractor expcetion: ! java.sql.SQLException: Conversion not supported for type xxx.enums.Gender ! at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1094) ~[mysql-connector-java-5.1.31.jar:na] ! at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:997) ~[mysql-connector-java-5.1.31.jar:na] ! at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:983) ~[mysql-connector-java-5.1.31.jar:na] ! at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:928) ~[mysql-connector-java-5.1.31.jar:na] ! at com.mysql.jdbc.ResultSetImpl.getObject(ResultSetImpl.java:5121) ~[mysql-connector-java-5.1.31.jar:na] ! at com.mysql.jdbc.JDBC4ResultSet.getObject(JDBC4ResultSet.java:542) ~[mysql-connector-java-5.1.31.jar:na] ! at org.springframework.jdbc.support.JdbcUtils.getResultSetValue(JdbcUtils.java:197) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.BeanPropertyRowMapper.getColumnValue(BeanPropertyRowMapper.java:311) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.BeanPropertyRowMapper.mapRow(BeanPropertyRowMapper.java:249) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:93) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:60) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:705) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:641) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! ... 69 common frames omitted ! Causing: org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [SELECT * FROM USER WHERE EMAIL = ?]; Conversion not supported for type xxx.enums.Gender; nested exception is java.sql.SQLException: Conversion not supported for type xxx.enums.Gender ! at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:108) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:657) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:692) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:719) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:769) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForObject(NamedParameterJdbcTemplate.java:211) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] {code} Is there any information I can provide?

    Spring JIRA | 2 years ago | cemo koc
    org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [SELECT * FROM USER WHERE EMAIL = ?]; Conversion not supported for type xxx.enums.Gender; nested exception is java.sql.SQLException: Conversion not supported for type xxx.enums.Gender
  2. 0

    I have updated our codebase to spring 4.1 and had some problems. I am working with MySQL 5.6 and latest driver (5.1.32) and JDK8. The block below from JdbcUtils is throwing an exception at line `return rs.getObject(index, requiredType);` {code} if (getObjectWithTypeAvailable) { try { return rs.getObject(index, requiredType); } catch (SQLFeatureNotSupportedException ex) { logger.debug("JDBC driver does not support JDBC 4.1 'getObject(int, Class)' method", ex); } catch (AbstractMethodError err) { logger.debug("JDBC driver does not implement JDBC 4.1 'getObject(int, Class)' method", err); } } // Fall back to getObject without type specification... return getResultSetValue(rs, index); {code} I have also evaluated last statement which is working as expected. {code} return getResultSetValue(rs, index); {code} Here is the details: {code} ERROR [2014-09-10 12:44:55,993] com.clovify.lyso.guava.OptionalExtractorFactory: guava extractor expcetion: ! java.sql.SQLException: Conversion not supported for type xxx.enums.Gender ! at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1094) ~[mysql-connector-java-5.1.31.jar:na] ! at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:997) ~[mysql-connector-java-5.1.31.jar:na] ! at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:983) ~[mysql-connector-java-5.1.31.jar:na] ! at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:928) ~[mysql-connector-java-5.1.31.jar:na] ! at com.mysql.jdbc.ResultSetImpl.getObject(ResultSetImpl.java:5121) ~[mysql-connector-java-5.1.31.jar:na] ! at com.mysql.jdbc.JDBC4ResultSet.getObject(JDBC4ResultSet.java:542) ~[mysql-connector-java-5.1.31.jar:na] ! at org.springframework.jdbc.support.JdbcUtils.getResultSetValue(JdbcUtils.java:197) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.BeanPropertyRowMapper.getColumnValue(BeanPropertyRowMapper.java:311) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.BeanPropertyRowMapper.mapRow(BeanPropertyRowMapper.java:249) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:93) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:60) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:705) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:641) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! ... 69 common frames omitted ! Causing: org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [SELECT * FROM USER WHERE EMAIL = ?]; Conversion not supported for type xxx.enums.Gender; nested exception is java.sql.SQLException: Conversion not supported for type xxx.enums.Gender ! at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:108) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:657) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:692) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:719) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:769) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] ! at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForObject(NamedParameterJdbcTemplate.java:211) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE] {code} Is there any information I can provide?

    Spring JIRA | 2 years ago | cemo koc
    org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [SELECT * FROM USER WHERE EMAIL = ?]; Conversion not supported for type xxx.enums.Gender; nested exception is java.sql.SQLException: Conversion not supported for type xxx.enums.Gender
  3. 0

    Polling consumer - Spring Forum

    spring.io | 11 months ago
    org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [SELECT INT_CHANNEL_MESSAGE.MESSAGE_ID, INT_CHANNEL_MESSAGE.MESSAGE_BYTES from INT_CHANNEL_MESSAGE where INT_CHANNEL_MESSAGE.GROUP_KEY = ? and INT_CHANNEL_MESSAGE.REGION = ? and INT_CHANNEL_MESSAGE.MESSAGE_ID not in (?) order by CREATED_DATE ASC LIMIT 1]; Parameter not set; nested exception is java.sql.SQLException: Parameter not set
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    PreparedStatement of JDBCTemplate throws exception "Before start of result set"

    Stack Overflow | 9 months ago | fanjavaid
    org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [SELECT * FROM position WHERE id = ?]; Before start of result set; nested exception is java.sql.SQLException: Before start of result set
  6. 0

    GitHub comment 40#149338851

    GitHub | 1 year ago | trisberg
    org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [INSERT INTO testdata(id, name, age) VALUES (?, ?, ?)]; Invalid argument value: java.io.NotSerializableException; nested exception is java.sql.SQLException: Invalid argument value: java.io.NotSerializableException

    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. org.springframework.dao.TransientDataAccessResourceException

      PreparedStatementCallback; SQL [SELECT * FROM USER WHERE EMAIL = ?]; Conversion not supported for type xxx.enums.Gender; nested exception is java.sql.SQLException: Conversion not supported for type xxx.enums.Gender

      at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate()
    2. Spring Framework
      NamedParameterJdbcTemplate.queryForObject
      1. org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:108)[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
      2. org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
      3. org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
      4. org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
      5. org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:657)[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
      6. org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:692)[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
      7. org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:719)[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
      8. org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:769)[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
      9. org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForObject(NamedParameterJdbcTemplate.java:211)[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
      9 frames