我有两个持久性单元persistence.xml和两个数据源,standalone.xml但我无法将表 A 绑定到持久性 1,将表 B 绑定到持久性 2像这样<persistence-unit name="itsetup-persistence-unit-dev1" transaction-type="JTA"> <description>Forge Persistence Unit</description> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/itsetup-dev1</jta-data-source> ...<persistence-unit name="itsetup-persistence-unit-dev3" transaction-type="JTA"> <description>Forge Persistence Unit</description> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/itsetup-dev3</jta-data-source> <class>my.package.User</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> ...和<datasource jndi-name="java:/itsetup-dev3" pool-name="itsetup-dev3" enabled="true" use-java-context="true"> <connection-url>jdbc:informix-sqli://server:9991/database</connection-url> <driver-class>com.informix.jdbc.IfxDriver</driver-class> <driver>ifxjdbc.jar</driver> <security> ...这是我的用户模型@Entity@PersistenceContext(unitName = "itsetup-persistence-unit-dev3")@Table(name = "user_file")public class User {我的用户服务在哪里@PersistenceContext(unitName = "itsetup-persistence-unit-dev3")private EntityManager em;课程表是@Entity@PersistenceContext(unitName = "itsetup-persistence-unit-dev1")@Table(name = "ppp_course")public class Course {和我的课程服务@PersistenceContext(unitName = "itsetup-persistence-unit-dev1")private EntityManager em;但是当我运行服务器时,它总是将其他表生成到 dev3 数据库中,就像它没有查看 dev1 数据库一样 Table not found: ppp_course我怎么能解决这个问题?
1 回答
忽然笑
TA贡献1806条经验 获得超5个赞
删除<property name="hibernate.archive.autodetection" value="class" />
的<persistence-unit name="itsetup-persistence-unit-dev3" transaction-type="JTA">
。但不得不失去自动检测功能。
添加回答
举报
0/150
提交
取消