Aggregate Identifier

Hello Guys anyone can help me.
I need to use long as AggregateIdentifier but failed

CreatedCommand:
@TargetAggregateIdentifier
private long id;

CreatedAggregate:
@AggregateIdentifier
private long id;

Hello Guys, this is error return after running
org.axonframework.commandhandling.CommandExecutionException(OUT_OF_RANGE: [AXONIQ-2000] Invalid sequence number 0 for aggregate 0, expected 1)

I need to use long like this
Model:
@Id
@Column(name = “id”, unique = true, nullable = false)
private long id;

Hi,

although it’s possible to use a long, it’s far from recommended to do so. In general, they make for very poor unique identifiers. In this particular case, I think your problem is related to the fact that a long is initialized with 0. Axon sees that as an initialized value (all non-null values are) and when events are applied, they are given the aggregate identifier 0.

The solution would be to use a Long instead, as it is initialized with a null.