【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;
}

你可能感兴趣的:(【SpringBoot】Cannot determine value type from string 'xxx' with root cause)