java.sql.SQLException: Fail to convert to internal

With multi-dimensional model as the core, let the factory digital transformation and upgrading “within reach”>>> java:745 )
Caused by: java.sql.SQLException: Fail to convert to internal representation
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError. java:113 )
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError. java:147 )
at oracle.jdbc.driver.DatabaseError.throwSqlException(Dat abaseError. java:209 )
at oracle.jdbc.driver.CharCommonAccessor.getByte(CharCommonAccessor. java:209 )
at oracle.jdbc.driver.OracleResultSetImpl.getByte(OracleResultSetImpl. java:464 )
at java:129 )
at JdbcUtils. java:154 )
at org.springframework.jdbc.core.BeanPropertyRowMapper.getColumnValue(BeanPropertyRowMapper. java:311 )
at org.springframework.jdbc.core.BeanPropertyRowMapper.mapRow(BeanPropertyRowMapper. java:249 )
at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor. java:93 )
at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor. java:60 )
at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate. java:460 )
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate. java:405 )

Look at the oracleresultsetimpl.getbyte in the exception information. This stack information describes that the data found in the database fails to be converted to the byte type

After checking the field type in the database table results and the data type defined in the entity class. Find app in entity class_ Type is defined as varchar type, and the corresponding field in the database is byte type. This causes the database to have an exception when mapping

Summary of problem handling steps:
1. Find the corresponding error field through exception information (such as getbyte in this example)
2. Check the byte type of the entity class and the type of the field in the database one by one
3. Confirm whether the conversion relationship corresponds, and adjust the database field type or entity field type

Similar Posts: