Hello everyone,
This is my first post in the group and with this opportunity I want to thank you for your great work in Axon framework.
The problem I'm facing is quite simple but I don't know if there is a built-in way to tackle it.
In my application I have a persistence context configuration with more than one persistence units. When I try to instantiate JpaEventStore in my Spring context I get the following error:
Error creating bean with name 'eventStore': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single bean but found 3
This error is caused due to the unqualified annotation @PersistenceContext found on setEntityManager in org.axonframework.eventstore.jpa.JpaEventStore.
In addition, extending JpaEventStore and overriding setEntityManager doesn't seem to work.
public class MyJpaEventStore extends JpaEventStore {
@PersistenceContext(unitName = "eventStorePersistenceUnit")
public void setEntityManager(EntityManager em) {
super.setEntityManager(em);
}
}
What would be the best way to deal with this scenario? Is it axon's responsibility to inject the entityManager in the first place?
Cheers,
Yannis