Our aggregates have ids which are not of type String (see example below). We would like to use GenericJpaRepository for storing aggregates. The issue we are experiencing is that TypeMismatchException is thrown when GenericJpaRepository wants to load aggregate using EntityManager.
` @Aggregate(repository=“myAggregateRepository”)
public class MyAggregate {
the Repository interface has been going from String to Object and vice versa for quite a while during the Axon 3 design. For certain reasons, Strings were more practical. I think a good “add-on” for the GenericJpaRepository would be to have a function that generates the actual ID type out of a given String, so that JPA can find the correct entity (probably by converting it back to a String again)…
It should be fairly simple to create a specialized implementation of a Repository, by extending the LockingRepository. You can use GenericJpaRepository as an example. The actual code (if you strip the configuration options) is actually very little.
You can also extend GenericJpaRepository and only override the doLoadWithLock method. The other methods actually don’t do anything with the identifier.
good news coming from Axon regarding this topic - as from version 3.0.5 you are going to be able to pass function (to GenericJpaRepository) which converts your type of id to a string.