Caused by: java.sql.SQLException: 'Infinity' is not a valid numeric or approximate numeric value

错误原因是:分母不能为0

hibernate在对数据进入写操作是,实体类的某一个字段为NaN(也就是在计算时分母为0)

hibernate会报这个错误,Mybatis也会报错具体如下:

[http-nio-8066-exec-32] ERROR com.hwidt.core.web.handler.GlobalExceptionHandler - 未知错误:{} org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='__frch _item_0.adjustProportion', mode=IN, javaType=class java.lang.Double, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: o rg.apache.ibatis.type.TypeException: Error setting non null for parameter #3 with JdbcType null . Try setting a different JdbcType for this parameter or a different configu ration property. Cause: java.sql.SQLException: 'Infinity' is not a valid numeric or approximate numeric value at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) at com.sun.proxy.$Proxy126.insert(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278) at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:58) at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:62) at com.sun.proxy.$Proxy207.batchInsert(Unknown Source) at com.unicorn.tools.product.brand.service.product.impl.SaleUpdateAuditServiceImpl.batchInsert(SaleUpdateAuditServiceImpl.java:120) at com.unicorn.tools.product.brand.service.tool.impl.ProductPutawayServiceImpl.upadteBy95Date(ProductPutawayServiceImpl.java:500) at com.unicorn.tools.product.brand.service.tool.impl.ProductPutawayServiceImpl$$FastClassBySpringCGLIB$$c69dbaba.invoke() at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:669) at com.unicorn.tools.product.brand.service.tool.impl.ProductPutawayServiceImpl$$EnhancerBySpringCGLIB$$c6ff77ff.upadteBy95Date() at com.unicorn.tools.product.brand.controller.tool.ProductPutawayController.updateProduct(ProductPutawayController.java:392) at sun.reflect.GeneratedMethodAccessor1547.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)

你可能感兴趣的:(Caused by: java.sql.SQLException: 'Infinity' is not a valid numeric or approximate numeric value)