there is an issue (https://github.com/AxonFramework/AxonFramework/issues/363) reported for this, but until now, it didn’t seem very reproducible. This may help in starting to understand what’s going on.
One suggestion there is that it is related to gaps. While gaps should be a very rare thing, in certain databases they are very common. This has to do with the way Hibernate generates sequences. It default to a single sequence generator used for all entities. A solution would be to configure a separate SequenceGenerator for the DomainEventEntry table, which can be done using the given configuration, which should be placed in a META-INF/orm.xml:
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="[http://java.sun.com/xml/ns/persistence/orm](http://java.sun.com/xml/ns/persistence/orm)" version="2.0">
<mapped-superclass class="org.axonframework.eventsourcing.eventstore.AbstractSequencedDomainEventEntry" access="FIELD">
<generated-value generator="domainEventGenerator" strategy="SEQUENCE"/>
<entity class="org.axonframework.eventsourcing.eventstore.jpa.DomainEventEntry" access="FIELD">
<sequence-generator name="domainEventGenerator" sequence-name="domain_event_seq" allocation-size="1"/>
Hope this relieves the issue, for now.