Hi,
First of all, congrats to the Axon team for finally bringing CQRS to
the Java world !
I was playing a little bit with Axon, everything when good up to the
point where I started dealing with more than one Aggregate Root while
doing event sourcing.
The symptoms were the following :
1. I instantiate a Foo object (Foo is an AR type). I add it to a
repository, and then load it back later --> ok, it works
2. I instantiate a Bar object (Bar is another AR type). I add it to a
repository, and then load it back later --> fails, I get a "Cannot
cast class Foo to Bar" !
When looking to Hibernate logs, I saw that the DomainEventEntry
corresponding to the creation of Bar actually had the aggregateType
"Foo" when being inserted in the db.
Ok, so one big headache later, I came to realize that I hadn't
declared the event sourcing repository for Bar in my Spring app
context.
So, instead of telling right to my face that I'm stupid, it looks like
Axon just tried to use another repository to store the event... which
worked. But, deserializing is another story
So, is that a normal behaviour ? (which I doubt ; or I might again be
missing something)
Is that a bug ?
Thanks,
Eric