Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-2295

Persistence Unit mapping-file ignored by CmpJpaConversion

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.7.5, 7.0.5, 7.1.0, 8.0.0-M1
    • 7.0.7, 7.1.2, 8.0.1
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              jgallimore Jonathan Gallimore
              jgallimore Jonathan Gallimore
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: