@GeneratedValue to generate globalIndex in domainEventEntry table is getting duplicated after upgrading springboot to 3.X

Hello All,

I am using PostgreSQL database and Axon Framework for one of my spring boot applications. I have upgraded the spring boot version from 2.x to 3.1.5. I have noticed that the Hibernate version also got change to 6.X. After upgrade, The globalIndex in domainEventEntry table is getting duplicated. I start getting primary key violation exceptions while storing events in the aforementioned table as the globaIndex is already present in it.

After googling for sometime, I got to know that some changes on ID generation have been introduced in Hibernate 6.X. I presumed this could be the reason and I added a property hibernate.id.new_generator_mappings: false in my application.properties file. But there is no improvement. Any suggestions are welcome! Thanks in advance for your help!

There is a similar post (issue when upgrading to Axon 3.2 and Spring Boot 2.0) which I followed, But did not help in my case!

Pom.XML

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.1.5</version>
        <relativePath/>
    </parent>

    <properties>
        <java.version>17</java.version>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <axon.version>4.8.2</axon.version>
    </properties>

DomainEventEntry.class (PreCompiled)

Sample Error:

{"@timestamp":"2024-05-29T18:06:31.388+02:00","@version":"1","message":"ERROR: duplicate key value violates unique constraint \"domain_event_entry_pkey\"\n  Detail: Key (global_index)=(502) already exists.","logger_name":"org.hibernate.engine.jdbc.spi.SqlExceptionHelper","thread_name":"global-gcp-pubsub-subscriber1","level":"ERROR","level_value":40000}