[ 
https://issues.apache.org/jira/browse/ARIES-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alexander Liepold updated ARIES-1711:
-------------------------------------
    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 :
 
{code: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>
{code}

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.

  was:
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 :
 
{code: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>
{code}

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 and 
build the Aries bundles I got it to work.


> Mapping files in persistence.xml not used
> -----------------------------------------
>
>                 Key: ARIES-1711
>                 URL: https://issues.apache.org/jira/browse/ARIES-1711
>             Project: Aries
>          Issue Type: Bug
>          Components: JPA
>    Affects Versions: jpa-2.7.0, jpa-2.6.1
>         Environment: Apache Aries 2.6.1
> Hibernate 5.0.7.Final
> Felix 5.6.1
> JPA 2.1
>            Reporter: Alexander Liepold
>             Fix For: jpa-2.7.0
>
>         Attachments: JPAHandler.java, PersistenceUnit.java
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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 :
>  
> {code: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>
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to