Hi,
I’m trying to figure out the best/correct way to handle the following problem in a JPA aggregate scenario:
AggregateA has an aggregate member EntityA. AggregateA contains a method that changes some state and also needs to create an EntityA if it doesn’t exist already. How should this be handled with Axon? I have tried to create a new EntityA (thinking it would be automatically handled) but get the following error:
“java.lang.IllegalStateException, org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing”.
Previously, before adding EntityA as an aggregate member, I was creating EntityA using a command constructor but I believe EntityA is really an aggregate member so would like to control it from AggregateA.
Apologies if I am missing something really obvious here.
Thanks