且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JdbcTemplate-忽略了SQLWarning:SQL状态为'22007',错误代码为'1292',消息为[错误的DOUBLE值被截断了错误:'stepExecutionContext [toId]']

更新时间:2023-09-05 07:50:04

之所以发生错误,是因为值stepExecutionContext[fromId]未被评估为SpEL表达式,并且原始(按原样)传递给数据库服务器.

The error happens because the value stepExecutionContext[fromId] is not evaluated as a SpEL expression and goes raw (as is) to the database server.

您链接到的示例使用正确的语法:<entry key="fromId" value="#{stepExecutionContext[fromId]}" />,但是在您的示例中,您具有:<entry key="fromId" value="stepExecutionContext[fromId]" />而没有#{...}.

The example you linked to uses the correct syntax: <entry key="fromId" value="#{stepExecutionContext[fromId]}" /> but in your example you have: <entry key="fromId" value="stepExecutionContext[fromId]" /> without the #{...}.

即使mkyong示例中的语法正确,但我还是建议在执行上下文(<entry key="fromId" value="#{stepExecutionContext['fromId']}" />)中的键周围使用简单的引号,如此处的官方文档中所述:

Even though the syntax in the example of mkyong is correct, I would recommend using simple quotes around keys in the execution context (<entry key="fromId" value="#{stepExecutionContext['fromId']}" />) as it is mentioned in the official documentation here: https://docs.spring.io/spring-batch/4.0.x/reference/html/step.html#late-binding