MyBatis报错:Cannot determine value type from string....
报错信息:
org. springframework. web. util. NestedServletExcepti on:Request processing f ailed;
nested exception is org.springframework. dao. DataIntegrityViolationExceptionError attempting to Cannot determine. value tvpe from string ” 2019-9-25 05:11: 48’nested ex ception is :java. sql. SQLDat aException: Cannot determine value tvpe from string ’2019-9-25 05: 11: 48
新建查询后出现了这个错误,经发现是实体类接收数据库数据类型不匹配导致的。(字段和属性没有对上)
日期格式在经过DATE_FORMAT之后
DATE_FORMAT(update_time,'%Y-%c-%d %h:%i:%s') as 'update_time',
使用Date类型属性接收报错,修改后使用String类型的属性接收。
还有一种情况也会导致报这种错:
还有一种情况,构造函数问题,有参构造创建后,无参构造没有创建,也会导致这个问题。弄了一下午,换数据库、换字段、换属性名都没解决,最后想起来是不是缺少无参构造了
There was an unexpected error (type=Internal Server Error, status=500). Error attempting to get column 'u_account' from result set.
Cause: java.sql.SQLDataException: Cannot determine value type from string '201577D0510' ;
Cannot determine value type from string '201577D0510'; nested exception is java.sql.SQLDataException:
Cannot determine value type from string '201577D0510' org.springframework.dao.DataIntegrityViolationException: Error attempting to get column 'u_account' from result set.
Cause: java.sql.SQLDataException: Cannot determine value type from string '201577D0510' ;
Cannot determine value type from string '201577D0510';
nested exception is java.sql.SQLDataException: Cannot determine value type from string '201577D0510' at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:84) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) at com.sun.proxy.$Proxy65.selectList(Unknown Source)