ERROR ..... o.h.e.jdbc.spi.SqlExceptionHelper - Duplicate entry '167-0' for key 'UKdg43ia27ypo1jovw2x64vbwv8'
.....
WARN 2018-02-22 21:48:14 [EventProcessor[...]-0] o.a.e.TrackingEventProcessor - Error occurred. Starting retry mode.
org.axonframework.eventsourcing.eventstore.EventStoreException: An event for aggregate [167] at sequence [0] could not be persisted
at org.axonframework.eventsourcing.eventstore.AbstractEventStorageEngine.handlePersistenceException(AbstractEventStorageEngine.java:139)
at org.axonframework.eventsourcing.eventstore.jpa.JpaEventStorageEngine.appendEvents(JpaEventStorageEngine.java:365)
at org.axonframework.eventsourcing.eventstore.AbstractEventStorageEngine.appendEvents(AbstractEventStorageEngine.java:112)
at org.axonframework.eventsourcing.eventstore.AbstractEventStore.prepareCommit(AbstractEventStore.java:64)
at org.axonframework.eventhandling.AbstractEventBus.doWithEvents(AbstractEventBus.java:209)
at org.axonframework.eventhandling.AbstractEventBus.lambda$null$4(AbstractEventBus.java:144)
at org.axonframework.messaging.unitofwork.MessageProcessingContext.notifyHandlers(MessageProcessingContext.java:68)
at org.axonframework.messaging.unitofwork.BatchingUnitOfWork.lambda$notifyHandlers$2(BatchingUnitOfWork.java:140)
at java.util.ArrayList$Itr.forEachRemaining(ArrayList.java:891)
.....
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '167-0' for key 'UKdg43ia27ypo1jovw2x64vbwv8'
I got this error when I used the same id(167) for different aggregate types in Axon3.
All event will be stored in DomainEventEntry entity. But unique index is "aggregateIdentifier,sequenceNumber".
@Table(indexes = @Index(columnList = "aggregateIdentifier,sequenceNumber", unique = true))
public class DomainEventEntry extends AbstractSequencedDomainEventEntry<byte[]> {...}
So if you want to use auto incremental id for various aggegate types, you should implement something for it or use UUID or key which combine aggregate name with auto incremental id like (group167)
댓글
댓글 쓰기