What method to judge the first time or not of the event with the identifier id?

Hi, if(What method can I use to judge the first time of the event with the identifier id?){

@Seth it is not clear enough what the purpose of your code intentions.
Are you simply trying to get if call a command for creation or update of an aggregate ?

I want to call the command on different condition,when I create a aggregate,I want to call InitCommand,once the aggregate be initiated and meantime I called InitCommand to do insert some data,after I want to call SecondCommand to update some data.

When I did not use axonserver,
I used "select count(1)
from domain_event_entry
where aggregate_identifier=#{aggregateIdentifier}
and sequence_number=‘0’ " to judge the aggregate be initiated or not,
but when I used axonserver,I found that there was not domain_event_entry,so what should I do to judge the aggregate be initiated or not?

When you want to make creating/reading operations on an aggregate you must separate the actions in 2 different command (CreateCommand and UpdateCommand).
Actually if you have an aggregateId you should be sure enough that it exists in the event store and you can go straight forward to an update operation.
if(aggregateId != null) {
} else {

But if in some circumstances you are not able to know that, you can just simply try to get a copy of the aggregate from the eventStore and check its existence.

Person p = commandGateway.sendAndWait(new CopyCommand(aggregateId));

if(p != null) {
} else {

//Inside Aggregate class
public Person handle(CopyCommand cmd)
return this.cloneObject(); //implement this method in order to build your object

NB: please note that you don’t need to manage aggregateId in the @CommandHandler since Axon is doing by its self.

I use@Resource
private EventStore eventStore;

DomainEventStream domainEventStream = eventStore.readEvents(myAggregateIdentifier);
or use
on the command updateCommand