Details
Description
The mapping files in a PeristenceUnit are not used by Apache Aries.
The same issue was noticed at this thread: http://karaf.922171.n3.nabble.com/Aries-JPA-2-3-0-mapping-file-not-used-td4047501.html
I have the same problem and I found out that the use of a mapping file in a persistence.xml works only on particular circumstances.
For example if I use the following declaration of a persistence.xml :
<?xml version="1.0" encoding="UTF-8"?> <persistence ... version="2.1"> <persistence-unit name="jpa.customer" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> <non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/testDB)</non-jta-data-source> <mapping-file>META-INF/developer-orm.xml</mapping-file> <mapping-file>META-INF/orm.xml</mapping-file> <class>test.Customer</class> ... <properties> ... </properties> </persistence-unit> </persistence>
On deployment of this persistence-unit the class test.Customer gets bootstrapped from Hibernate. The mapping file META-INF/orm.xml is detected automatically from the persistence provider.
But the mapping file META-INF/developer-orm.xml is never detected.
If I fixed the particular code in the module Aries JPA Container locally. After building and testing the Apache Aries Project I could deploy a persistence.xml with multiple mapping files.