tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TOMEE-2295) Persistence Unit mapping-file ignored by CmpJpaConversion
Date Thu, 29 Nov 2018 10:18:00 GMT

    [ https://issues.apache.org/jira/browse/TOMEE-2295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16702977#comment-16702977
] 

ASF GitHub Bot commented on TOMEE-2295:
---------------------------------------

GitHub user jgallimore opened a pull request:

    https://github.com/apache/tomee/pull/222

    TOMEE-2295 fix <mapping-file> being ignored

    This is still a work in progress as I'd like to incorporate some Arquillian tests today,
and ensure that this works with things like relationships between entities.
    
    The change here is fairly straightforward though; we pick up a persistence unit called
"cmp", if one has been defined, and read all the <mapping-file> elements on it. If an
entity has been defined in one of those mappings files, we add the entity class to a set,
and the CMP/JPA processing will simply ignore it. The persistence provider should then use
the mapping that has been defined in the mapping file and not generate its own

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jgallimore/tomee cmp-jpa

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tomee/pull/222.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #222
    
----
commit 9c585b0cf133219f0039864516dcdc828d3b609c
Author: Jonathan Gallimore <jon@...>
Date:   2018-11-28T11:51:18Z

    TOMEE-2295 test for <mapping-file> element being ignored

commit ddbae44e280cb9e8f0e10ea7754b5eed69733cb4
Author: Jonathan Gallimore <jon@...>
Date:   2018-11-28T13:53:40Z

    TOMEE-2295 Improvements for JPA/CMP mapping

commit a220243932db5968a78d6a08c7ab238b350b368b
Author: Jonathan Gallimore <jon@...>
Date:   2018-11-28T20:00:45Z

    TOMEE-2295 PMD

commit 017cac6db4bd4c8bd93c690e24ff6bf7e64977ea
Author: Jonathan Gallimore <jon@...>
Date:   2018-11-29T09:49:17Z

    Merge branch 'master' into cmp-jpa

----


> Persistence Unit mapping-file ignored by CmpJpaConversion
> ---------------------------------------------------------
>
>                 Key: TOMEE-2295
>                 URL: https://issues.apache.org/jira/browse/TOMEE-2295
>             Project: TomEE
>          Issue Type: Bug
>    Affects Versions: 1.7.5, 8.0.0-M1, 7.0.5, 7.1.0
>            Reporter: Jonathan Gallimore
>            Assignee: Jonathan Gallimore
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 8.0.0-Final, 1.7.6, 7.0.6, 7.1.1
>
>
> The CmpJpaConversion code enables TomEE to run CMP entity beans by converting them to
JPA "on the fly". It does this by using a persistence unit it creates on the app module named
"cmp", and generating an orm.xml file for the persistence component to use.
>  
> However, if you create a persistence.xml file and a custom orm.xml file (using the `openejb.descriptors.output=true`
system property, for example) and reference the custom orm.xml in persistence.xml, it is
ignored.
>  
> One possible workaround is to remove the mapping file reference from persistence.xml
and package it in the artifact as META-INF/openejb-cmp-orm.xml (or WEB-INF/openejb-cmp-orm.xml
for .war files): [https://github.com/apache/tomee/blob/0165264d37f9cb6ce6d2585f2f6b0fbd926ad5c4/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java#L553] and
[https://github.com/apache/tomee/blob/0165264d37f9cb6ce6d2585f2f6b0fbd926ad5c4/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/cmp/CmpMappingTest.java#L45]
>  
> However, it should be possible to also check for the presence of an existing mapping
file on the cmp persistence unit, and use that as opposed to generating a new one.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message