Nicolas Breuninger
Nicolas Breuninger

Reputation: 263

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

I just started to use the Axon-Framework and I like it a lot. So I wanted to integrate it in an existing project. But when I try to start my application I get the following errors:

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).

I do understand that an unique constraint is violated but the table is managed by the axon framework. I tested it an new project and looked at the database. And the table token_entry did not contain the _identifier_mapper_processor_name column. Then I looked at the database of my old project and the table contained the two additional columns: _identifier_mapper_processor_name, _identifier_mapper_segment.

Why does an table of the axon framework sometimes contain these addional columns and sometimes not?

Upvotes: 0

Views: 785

Answers (2)

Nicolas Breuninger
Nicolas Breuninger

Reputation: 263

The problem seems to be hibernate. The ImplicitNamingStrategyComponentPathImpl naming strategy (which is used by my project) has a problem with @IdClass: Ticket.

The axon framework uses @IdClass for the token_entry table. This leads to the error described above.

Upvotes: 3

Steven
Steven

Reputation: 7275

Neither _identifier_mapper_processor_name nor _identifier_mapper_segment occur in any search you'd perform on the Axon Framework GitHub page. Thus, not in current framework code nor any commits over the last 10 years of Axon's existence.

Hence, I am very hard pressed to understand how you did end up with both columns to begin with. Would you mind sharing what version of Axon you're using and if you are adding any Axon Framework Extensions to the project too?

As far as resolving the problem, I'd assume something is tagging along when creating the token_entry table in your existing project. Any specifics you are doing in your existing project as far as Axon and/or database modification would be beneficial to deduce where this problem stems from.

Upvotes: 2

Related Questions