为什么轴突框架无法插入自己的table?

Why is the axon framework not able to insert in its own table?

我刚开始使用Axon-Framework,我非常喜欢它。所以我想把它集成到一个现有的项目中。但是当我尝试启动我的应用程序时,出现以下错误:

Fetch Segments for Processor 'my.package.name' failed: org.hibernate.exception.ConstraintViolationException: could not execute statement. Preparing for retry in 4s

ERROR: null value in column "_identifier_mapper_processor_name" violates not-null constraint
  Detail: Failing row contains (my.package.name, 0, null, null, null, 2020-01-21T09:32:28.189Z, null, null).

我知道违反了唯一约束,但 table 由轴突框架管理。我测试了一个新项目并查看了数据库。 table token_entry 不包含 _identifier_mapper_processor_name 列。然后我查看了旧项目的数据库,table 包含两个附加列:_identifier_mapper_processor_name_identifier_mapper_segment.

为什么 table 轴突框架有时包含这些额外的列,有时不包含?

_identifier_mapper_processor_name_identifier_mapper_segment 都不会出现在您在 Axon Framework GitHub 页面上执行的任何搜索中。因此,不在当前的框架代码中,也不在 Axon 存在的最后 10 年中的任何提交。

因此,我很难理解您是如何从两栏开始的。您介意分享您正在使用的 Axon 版本吗?如果您也向项目添加任何 Axon 框架扩展?

就解决问题而言,我假设在您现有项目中创建 token_entry table 时有一些标记。 就 Axon and/or 数据库修改而言,您在现有项目中所做的任何细节都将有助于推断出问题的根源。

问题似乎是休眠。 ImplicitNamingStrategyComponentPathImpl命名策略(我的项目使用的)与@IdClass有问题:Ticket.

轴突框架使用 @IdClass 作为 token_entry table。这会导致上述错误。