有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Wildfly上的java多持久化单元

我将JPA与Wildfly一起使用,并连接到多个数据库。下面是持久性。xml-

<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>

我这么说

public class ContiegoEJB {

   @PersistenceContext(unitName="ContiegoDS")
   protected EntityManager contiegoEntityManager;

   @PersistenceContext(unitName="ContiegoWebsiteDS")
   protected EntityManager contiegoWebsiteEntityManager;

   public ContiegoEJB() {
   }

}

但我得到了这个错误

Here is the error log I can't post more code-text in the question

orm和orm网站的比较。xml文件

enter image description here

AdminUser和AdminUserPasswordRecovery实体。。。 AdminUser and AdminUserPasswordRecovery entities.

从AdminUserPasswordRecoveryRequest到AdminUser的多对一关系 enter image description here

我可能做错了什么


共 (0) 个答案