报错 org.springframework.dao.DataIntegrityViolationException: Error attempting to get column(Error org.springframework.dao.dataintegrityviolationexception: error attempting to get column)

错误

dao.DataIntegrityViolationException: Error attempting to get column 'owner_name' from result set.  Cause: java.sql.SQLDataException: Cannot determine value type from string '大老板'

原因:

  • 数据库字段与实体类字段类型不匹配
  • 如果代码中使用了union,union中的每个sql字段必须一一对应,当对应的数据类型有误时则会报上述异常
————————

error

dao.DataIntegrityViolationException: Error attempting to get column 'owner_name' from result set.  Cause: java.sql.SQLDataException: Cannot determine value type from string '大老板'

reason:

  • Database field does not match entity class field type
  • If union is used in the code, each SQL field in the union must correspond one by one. When the corresponding data type is wrong, the above exception will be reported