No I didnt, I’ve handled the command in my Aggregate such as…
final class Hotel extends AbstractAnnotatedAggregateRoot {
@AggregateIdentifier
private String id;
public Hotel() {
}
@CommandHandler
public void on(RegisterHotel cmd) {
apply(new HotelRegistered(...));
}
Since it’s the command that creates a new hotel instance, it should be a constructor instead of an instance method. Replace “void on” by “Hotel” and you’re all set.