【发布时间】:2014-03-27 16:56:13
【问题描述】:
我在我的系统中使用多个数据库。我正在使用AtomikosDataSourceBean 在多个数据库之间启用 xa 分布式事务。
在spring-configuration.xml 文件中,我可以为两个独立的EntityManagerFactory 创建bean,比如entityManagerFactory1 和entityManagerFactory2。但是当我使用 Spring Java @Configuration 执行此操作时,出现错误。
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'entityManagerFactory' is defined
如果我将一个创建为 entityManagerFactory,另一个创建为 entityManagerFactory1,则会收到错误
Caused by: java.lang.IllegalArgumentException: Not an managed type: class com.tom.boon.core.model.Person
对于在 entityManagerFactory1 下创建的实体。
有人可以帮我弄清楚如何在 Spring Java @Configuration 中定义两个独立的 entityManagerFactory。
【问题讨论】:
标签: spring entitymanager spring-data-jpa jta spring-java-config