I am upgrading my JDK8+Axon 3.x application to Java 17 + Axon 4.10 with Hibernate 6
While creating an event, I get following error
Cannot insert explicit value for identity column in table ‘domain_event_entry’ when IDENTITY_INSERT is set to OFF
the fact that I have upgraded to Hibernate 6, I have also created a sequence domain_event_enty_seq - However, it looks like it is not able to insert explicit value in global_index column which is primary key and identity column
I am afraid that the exception you are getting does not ring a bell to me, @jinwalakv. Perhaps you can share the full stack trace? The entire stack trace typically gives more useful feedback than just the failure message.
A quick search on “IDENTITY_INSERT is set to OFF” brings me to database-specific pages. Perhaps it has something to do with the chosen storage solution for events? So, could you also share what RDBMS you have your events in?
Furthermore, I am not sure why you had to create the domain_event_enty_seq. I know that Hibernate 6 now prefers sequences per table (which is a good thing!), but if you used Axon Framework’s defaults for sequence generation of the globalIndex, that means you did not have a unique generator for the globalIndex field of the domain_event_entry table. Hence, you are not only migration, but also adjusting the behavior. Perhaps it is wiser to perform that task separately, once the migration succeeded?
Besides the above, I have another suggested flow. Although I understand you’d much rather jump to the latest Axon Framework version, we had to introduce breaking changes between AF 4.6 and 4.7, specifically around our desire to support Spring Boot 3 (and thus Jakarta persistence and Hibernate 6).
That said, if you are still stuck with the migration, could you try to migrate to 4.6 of Axon Framework first? And if you’ve done this, do you get the same exception?