Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to setup spring data jpa with multiple datasources

I am using Spring Data Jpa version 1.0.0.M2 here is the url: http://static.springsource.org/spring-data/data-jpa/docs/1.0.0.M2/reference/pdf/spring-data-jpa-reference.pdf

All is promised to be very simple and nice, but when it comes to two datasources it breaks down. The question is how to setup with two data sources? The JpaRepository automatically searches for EntityManager, when it finds more than two it throws exceptions.

If you have any idea with EntityManager and how to setup the spring data jpa, please post a reply. Your help is truly appreciated!!!

like image 352
truthseeker Avatar asked May 24 '26 21:05

truthseeker


1 Answers

<jpa:repositories base-package="org.springframework.data.jpa.repository.sample"
    entity-manager-factory-ref="secondEntityManagerFactory" />
like image 57
Leonid Avatar answered May 27 '26 10:05

Leonid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!