尝试将 table 不干净记录验证为具有干净数据的新 table 时出现 QuerySyntaxException。需要映射实体吗?

QuerySyntaxException when trying to validate a table of unclean records to a new table with clean data. Necessary to map entities?

我有一个不干净的 UncleanRecord tbl,其中包含脏数据和未经验证的数据。 我的计划是遍历 tbl 中的所有记录,然后清理并验证它以将其添加到我的新 CleanRecord tbl 中。

我正在使用 Spring Batch with Hibernate。当我执行作业时,它返回了这些错误:

org.springframework.batch.core.step.AbstractStep  - Encountered an error executing step step1 in job validate
org.springframework.batch.item.ItemStreamException: Failed to initialize the reader
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: UNCLEANRECORD is not mapped [SELECT name, contact,address FROM UNCLEANRECORD WHERE date is null]
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: UNCLEANRECORD is not mapped

我有实体 UncleanRecord 和 CleanRecord。 由于控制台日志中的错误,我想我需要将 UncleanRecord 映射到 CleanRecord?然而,Unclean 中的数据是不一致的——UncleanRecords 中也没有唯一标识符……它纯粹是为了存储传递到应用程序中的任何数据。 UncleanRecord 中的行在添加到 CleanRecord

之前将根据 CleanRecord 检查

没有 Hibernate 映射是否可以实现我想要的?

我知道我可以使用 RowMapper<> 执行上述操作,但是,我使用的是 Hibernate。

您似乎正在使用 HQL/JPQL 查询,该查询需要名为 UNCLEANRECORD 的实体存在,但实际上并不存在。我不知道 spring-batch 是如何工作的,但看起来您应该将查询标记为本机查询。