Data truncation: Cannot create a JSON value from a string with CHARACTER SET 'binary'
最后更新:2024-05-02 09:05:25
|
状态:未完成
出现这个异常是因为视图把json类型保存到数据库中,一般来说数据库会设置一个JSON类型。
但在页mysql驱动对json的sql类型会要求一个String类型的数据,
需要打开ConfigTable.IS_AUTO_CHECK_METADATA = true ,这样在插入或更新时会先检测数据库中的数据类型,根据检测结果转换成相应的类型。
但在页mysql驱动对json的sql类型会要求一个String类型的数据,
需要打开ConfigTable.IS_AUTO_CHECK_METADATA = true ,这样在插入或更新时会先检测数据库中的数据类型,根据检测结果转换成相应的类型。
org.anyline.exception.SQLUpdateException: insert异常:org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; Data truncation: Cannot create a JSON value from a string with CHARACTER SET 'binary'.; nested exception is com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Cannot create a JSON value from a string with CHARACTER SET 'binary'. at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:104) ~[spring-jdbc-5.3.21.jar:5.3.21] at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70) ~[spring-jdbc-5.3.21.jar:5.3.21] at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:79) ~[spring-jdbc-5.3.21.jar:5.3.21] at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:79) ~[spring-jdbc-5.3.21.jar:5.3.21] at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1541) ~[spring-jdbc-5.3.21.jar:5.3.21] at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:667) ~[spring-jdbc-5.3.21.jar:5.3.21] at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:991) ~[spring-jdbc-5.3.21.jar:5.3.21] at org.anyline.data.adapter.init.SQLAdapter.insert(SQLAdapter.java:473) ~[anyline-data-jdbc-8.7.2.jar:na] at org.anyline.data.adapter.init.SQLAdapter$$FastClassBySpringCGLIB$$bca16294.invoke(<generated>) ~[anyline-data-jdbc-8.7.2.jar:na] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.21.jar:5.3.21] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793) ~[spring-aop-5.3.21.jar:5.3.21] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.3.21.jar:5.3.21] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) ~[spring-aop-5.3.21.jar:5.3.21] at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137) ~[spring-tx-5.3.21.jar:5.3.21] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.21.jar:5.3.21] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) ~[spring-aop-5.3.21.jar:5.3.21] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708) ~[spring-aop-5.3.21.jar:5.3.21] at org.anyline.data.jdbc.mysql.MySQLAdapter$$EnhancerBySpringCGLIB$$a5e7867f.insert(<generated>) ~[anyline-data-jdbc-mysql-8.7.2-20230729.040128-6.jar:na] at org.anyline.dao.init.springjdbc.DefaultDao.insert(DefaultDao.java:1023) ~[anyline-data-jdbc-8.7.2.jar:na] at org.anyline.dao.init.springjdbc.DefaultDao.insert(DefaultDao.java:957) ~[anyline-data-jdbc-8.7.2.jar:na] at org.anyline.dao.init.springjdbc.DefaultDao.insert(DefaultDao.java:1253) ~[anyline-data-jdbc-8.7.2.jar:na] at org.anyline.dao.init.springjdbc.DefaultDao$$FastClassBySpringCGLIB$$5852786d.invoke(<generated>) ~[anyline-data-jdbc-8.7.2.jar:na] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.21.jar:5.3.21] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793) ~[spring-aop-5.3.21.jar:5.3.21] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.3.21.jar:5.3.21] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) ~[spring-aop-5.3.21.jar:5.3.21] at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137) ~[spring-tx-5.3.21.jar:5.3.21] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.21.jar:5.3.21] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) ~[spring-aop-5.3.21.jar:5.3.21] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708) ~[spring-aop-5.3.21.jar:5.3.21] at org.anyline.dao.init.springjdbc.DefaultDao$$EnhancerBySpringCGLIB$$ab216de6.insert(<generated>) ~[anyline-data-jdbc-8.7.2.jar:na] at org.anyline.service.init.DefaultService.insert(DefaultService.java:1508) ~[anyline-data-jdbc-8.7.2.jar:na] at org.anyline.service.init.DefaultService.insert(DefaultService.java:1520) ~[anyline-data-jdbc-8.7.2.jar:na] at org.anyline.service.init.DefaultService.insert(DefaultService.java:1558) ~[anyline-data-jdbc-8.7.2.jar:na]