Mar 12th, 2012, 07:13 AM
Jpa repositories - inject twice the repositories for different entityManager
I am using Spring Data Jpa for my project.
I have some troubles to inject twice the JPA repositories.
I am currently trying to transfer data from 2 databases with the same schema (I cannot use ETL tools, this must be done in Java).
<jpa:repositories base-package="ec.ep.dgcomm.wmu.eng.coredata.accessors.p roducts">
<jpa:repository id="myRepositorySource" entity-manager-factory-ref="entityManagerFactorySource" transaction-manager-ref="transactionManagerSource"/>
<jpa:repository id="myRepositoryTarget" entity-manager-factory-ref="entityManagerFactoryTarget" transaction-manager-ref="transactionManagerTarget"/>
My problem is that the id must be the name of the class.
My question is how to define 2 repositories implementing the same interface here "MyRepository"
Thanks for your help,