You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Alexander Liepold (JIRA)" <ji...@apache.org> on 2017/04/07 13:25:41 UTC

[jira] [Updated] (ARIES-1711) Mapping files in persistence.xml not used

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

Alexander Liepold updated ARIES-1711:
-------------------------------------
    Attachment: PersistenceUnit.java
                JPAHandler.java

I have added the two java classes which would fix this issue.
 
Because I have no access rights for uploading these files to trunk.

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



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