Java Wildfly上的多个持久化单元
我将JPA与Wildfly一起使用,并连接到多个数据库。下面是persistence.xml-Java Wildfly上的多个持久化单元,java,jpa,persistence.xml,Java,Jpa,Persistence.xml,我将JPA与Wildfly一起使用,并连接到多个数据库。下面是persistence.xml- <persistence-unit name="ContiegoDS" transaction-type="JTA"> <jta-data-source>java:jboss/datasources/ContiegoDS</jta-data-source> <mapping-file>META-INF/orm.xml</mappin
<persistence-unit name="ContiegoDS" transaction-type="JTA">
<jta-data-source>java:jboss/datasources/ContiegoDS</jta-data-source>
<mapping-file>META-INF/orm.xml</mapping-file>
<mapping-file>META-INF/orm-legacy.xml</mapping-file>
<mapping-file>META-INF/queries/native.xml</mapping-file>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect" value="org.hibernate.spatial.dialect.mysql.MySQLSpatial56Dialect" />
<property name="hibernate.globally_quoted_identifiers" value="true"/>
<property name="hibernate.hbm2ddl.import_files_sql_extractor" value="org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor" />
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.show_sql" value="true" />
</properties>
</persistence-unit>
<persistence-unit name="ContiegoWebsiteDS" transaction-type="JTA">
<jta-data-source>java:jboss/datasources/ContiegoWebsiteDS</jta-data-source>
<mapping-file>META-INF/orm-website.xml</mapping-file>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect" value="org.hibernate.spatial.dialect.mysql.MySQLSpatial56Dialect" />
<property name="hibernate.globally_quoted_identifiers" value="true"/>
<property name="hibernate.hbm2ddl.import_files_sql_extractor" value="org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor" />
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.show_sql" value="true" />
</properties>
</persistence-unit>
但我得到了这个错误
orm与orm-WEBSET.xml文件的比较
AdminUser和AdminUserPasswordRecovery实体。。。
从AdminUserPasswordRecoveryRequest到AdminUser的多对一关系
我可能做错了什么 从错误消息中发布更多信息。添加为图像。。。感谢您的时间:)您能对它抱怨的“AdminUser”实体说些什么?它正确地映射到orm.xml(contiegoods)上,但从未映射到orm-website.xml(contiegowebsites),因为该实体不存在或不在该数据库上使用。所以我不明白为什么这个实体会成为一个问题。。。我从persistence.xml文件中删除了contiegowebsites,效果很好。事实上,我将orm-website.xml更改为orm.xml,看起来效果不错(但没有从其他数据库映射我的实体)。我更新了我的问题,添加了我的orm文件
public class ContiegoEJB {
@PersistenceContext(unitName="ContiegoDS")
protected EntityManager contiegoEntityManager;
@PersistenceContext(unitName="ContiegoWebsiteDS")
protected EntityManager contiegoWebsiteEntityManager;
public ContiegoEJB() {
}
}