(Composite) persistence.xml: NamedQuery of name XYZ not found. [message #1207999] |
Sun, 24 November 2013 17:03  |
Eclipse User |
|
|
|
Hello everybody,
I am in the process of modularizing a Java EE application (Java EE 7, Glassfish 4, JPA 2.1, EclipseLink 2.5). Everything worked fine so far, but I am currently experiencing a showstopper.
---
Scenario:
I have an EAR called "myApp.ear" that has dependencies to two EJB/Entity modules represented as JARs called "myModule1.jar" and "myModule2.jar". "myModule2.jar" is also dependent of "myModule1.jar". Each module defines its own persistence.xml in META-INF. The EAR also defines a persistence.xml which serves as the composite persistence.xml.
I have configured everything as explained in the EclipseLink doc.
Everything is working fine: Interaction with JSF modules, EntityManager operations like find(), persist(), etc. Except one thing is constantly going wrong trying to use a named query: "NamedQuery of name XYZ not found". The named queries are all defined in the entities via @NamedQuery. In the unmodularized recent version of the application they are all working fine, I have not changed the original and working code at any point.
I have altered almost every possible setting in the persistence.xml´s like <class>, <mapping-file> and so on. I have varied the persistence.xml´s to death, tried all and everything I could think of, searched the net a hundred times, but sadly there is no solution in sight. I don´t care how I am getting my modularized app to work, I just want it to work without "NamedQuery of name XYZ not found". Any help is greatly appreciated. Here are my persistence units:
------------------------------------
"myApp.ear":
<persistence-unit name="myApp" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<validation-mode>CALLBACK</validation-mode>
<jar-file>myModule1.jar</jar-file>
<jar-file>myModule2.jar</jar-file>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.application-location" value="E:\_dirsync\_snc\htdocs\snc\snc-ejb\src\java\de\blacksmiths\snc\backend\sql\" />
<property name="eclipselink.composite-unit" value="true"/>
<property name="eclipselink.create-ddl-jdbc-file-name" value="ddl_create.sql"/>
<property name="eclipselink.ddl-generation" value="create-tables"/>
<property name="eclipselink.ddl-generation.output-mode" value="both"/>
<property name="eclipselink.drop-ddl-jdbc-file-name" value="ddl_drop.sql"/>
<property name="eclipselink.logging.level" value="FINE"/>
<property name="eclipselink.logging.level.sql" value="FINE"/>
<property name="eclipselink.logging.parameters" value="true"/>
</properties>
</persistence-unit>
------------------------------------
"myModule1.jar":
<persistence-unit name="myModule1" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/myConnectionPool</jta-data-source>
<mapping-file>META-INF/orm.xml</mapping-file>
<class>de.snc.backend.auth.entity.Auth</class>
<class>de.snc.backend.user.entity.User</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
</persistence-unit>
------------------------------------
"myModule2.jar":
<persistence-unit name="myModule2" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/myConnectionPool</jta-data-source>
<mapping-file>META-INF/orm.xml</mapping-file>
<class>de.snc.backend.user.entity.User</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
</persistence-unit>
------------------------------------
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05803 seconds