0

I'm using JPA with Wildfly and I am connecting to multiple databases. Below is the 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</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>

I'm calling it this way

public class ContiegoEJB {

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

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

   public ContiegoEJB() {
   }

}

But I'm getting this error

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

Comparisson between orm and orm-website.xml files

enter image description here

AdminUser and AdminUserPasswordRecovery entities... AdminUser and AdminUserPasswordRecovery entities.

Relation many to one from AdminUserPasswordRecoveryRequest to AdminUser enter image description here

What can I possible doing wrong?

Víctor Cardozo
  • 153
  • 2
  • 13
  • Post more from your error message. – jklee Feb 03 '17 at 18:01
  • Added as a image ... Thanks for your time :) – Víctor Cardozo Feb 03 '17 at 18:33
  • and what can you say about the entity it is complaining about "AdminUser" ? – Neil Stockton Feb 03 '17 at 18:39
  • Is properly mapped on orm.xml (ContiegoDS), but is never mapped on orm-website.xml (ContiegoWebsiteDS) because the entity is not present or used on this DB. So I can't understand why this entity can be a problem... I remove ContiegoWebsiteDS from my persistence.xml file and works fine. In fact, I change orm-website.xml to orm.xml and seems to work good (but has no my entities mapped from the other DB) – Víctor Cardozo Feb 03 '17 at 18:46
  • I updated my question adding my orm files – Víctor Cardozo Feb 03 '17 at 18:49

0 Answers0