【SpringBoot】Cannot determine value type from string 'xxx' with root cause

开发SpringBoot过程中程序发生异常,提示“Cannot determine value type from string 'xxx' with root cause”错误,根据Log显示数据格式错误,试了修改数据格式,没用,在此记录解决办法。

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: Error attempting to get column 'name' from result set.  Cause: java.sql.SQLDataException: Cannot determine value type from string 'xiaoming'
; Cannot determine value type from string 'xiaoming'; nested exception is java.sql.SQLDataException: Cannot determine value type from string 'xiaoming'] with root cause

com.mysql.cj.exceptions.DataConversionException: Cannot determine value type from string 'xiaoming'

解决办法:这种情况出现还可能是实体类实现有参构造函数后,没有写无参构造函数,添加无参构造函数即可。

//无参构造函数
public UserBean() {
        
}

public UserBean(String name, int age) {
    this.name = name;
    this.age = age;
}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容