State-Stored Aggregates: No handler was subscribed to command

Hi,

I am following the example https://docs.axoniq.io/reference-guide/implementing-domain-logic/command-handling/state-stored-aggregates to store the aggregate as-is-too on a table, but for some reason the @CommandHandler on the constructor of the class is not detcted throwing a NoHandleForCommandException(No handler was subscribed to command…). The only option to enable the @CommandHandler o is change the @Entity to @Aggregate.

How Axon can detected a @CommandHandler for a @Entity?.

Regards,
Jose Coronel

Hi Jose,

you will need to add both Axon’s @Aggregate as well as Hibernate’s @Entity to create a state-stored aggregate. If you remove the @Aggregate, then Axon doesn’t see that class as one that could potentially handle commands.

Cheers,

twitter-icon_128x128.png