如何使用多个数据源设置spring数据jpa [英] how to setup spring data jpa with multiple datasources
问题描述
我正在使用Spring Data Jpa版本1.0.0.M2,这是URL: http://static.springsource.org/spring-data/data-jpa/docs/1.0.0.M2/reference/pdf/spring-data-jpa-reference.pdf
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
所有内容都非常简单好用,但是当涉及到两个数据源时,它就会崩溃.问题是如何设置两个数据源? JpaRepository自动发现EntityManager,当发现两个以上时,将引发异常.
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.
如果您对EntityManager以及对如何设置spring数据jpa有任何想法,请发表回复.非常感谢您的帮助!!!
If you have any idea with EntityManager and how to setup the spring data jpa, please post a reply. Your help is truly appreciated!!!
推荐答案
<jpa:repositories base-package="org.springframework.data.jpa.repository.sample"
entity-manager-factory-ref="secondEntityManagerFactory" />
这篇关于如何使用多个数据源设置spring数据jpa的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!