春季批处理作业没有作者的错误,但数据库不会更新
抱歉,无法在此处添加代码。我将尽量解释。
实体:数据库1(MySQL-HAS用户表),数据库2(mysql-空),SpringBatch作业
工作条件:当我运行SpringBatch作业以从数据库1读取用户数据并对其进行处理并编写它时,代码可以工作。该表被更新了。但是Spring Batch还可以在此数据库(IE数据库1)上创建其元数据。
新条件:当我将SpringBatch配置以将新数据源(IE数据库2)用于其元数据时,除了ItemWriter以外,所有工作都没有将更新的用户数据写入数据库1.终端没有错误,它说数据编写成功了。因此,在这种情况下,基本上是:从数据库1中的读取都不错,批量编写批处理元数据都不错。
实验:
- 正确的数据进入了ItemReader内部,通过日志记录
- ItemProcessor验证,此外,它自动将用户的名称自动化。
- 有效的处理数据即将通过日志记录验证。
- 如果我手动从用户表中删除一列,则作者通过说无法将其写入表,因为该特定列不存在。这证明了作者正在用正确的存储库来检测正确的表。
- 但是,当一切都有效时,作者说数据已在表中更新,但是当我查看表时没有更改。
有什么建议为什么?
Sorry, can not add code here. I will try to explain as much as possible.
Entities: Database 1 (MySQL-has User Table), Database 2 (MySQL- Empty), SpringBatch Job
Working condition: When I run SpringBatch Job to read the User data from Database 1 and process it and write it, the code works. The table gets updated. But spring batch also creates its meta data on this database (i.e Database 1).
New condition: When I configure SpringBatch to use new DataSource (i.e. Database 2) for its metadata, everything works except ItemWriter does not write the updated User data to Database 1.There are no errors on the terminal and it says that data writing was successful. So basically in this situation: Reading from Database 1 is all good, writing BATCH METADATA to Database 2 by Batch is all good, ItemWriter says it has updated data to the User table in Database 1 after processing but I don't see the change.
Experimentation:
- Correct data is coming inside ItemReader, verified by logging
- ItemProcessor is working as except, here it auto capitalizes the names of Users.
- Valid Processed Data is coming to the ItemWriter, verified by logging.
- If I remove a column from the User Table manually, the writer throws error by saying that it could not write to the table since that particular column does not exist. This proves the writer is detecting the correct table with correct repository.
- But when everything is valid, Writer says data has been updated in table but there is no changes when I look into the table.
Any suggestion why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论