Hi

This continues on from the work that Otavio did on this thread: "Creates an
unmarshal that does not filter to JavaEE namespace".

For those of you who aren't aware, TomEE supports CMP entity beans (which
is quite an old way of doing persistence - it dates back to the EJB 2.1 era
- and possibly earlier, I started using EJB around 2.1), and it does this
by converting them to JPA entities on the fly and creating an ORM mapping
file in XML for the persistence provider to use. It uses a special
persistence unit called "cmp".

One of the nice things you can do is use
the openejb.descriptors.output=true system property, and you'll get the
persistence.xml and orm.xml file that was generated at deploy time.
Unfortunately, if you try and customize the ORM xml, and provide both the
persistence xml and ORM xml files in your app, using the <mapping-file> tag
in persistence.xml (something like the example below), it doesn't work, and
the auto generated mappings are still used instead.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"; version="2.0">
    <persistence-unit name="cmp" transaction-type="JTA">
        <jta-data-source>jta-ds</jta-data-source>
        <non-jta-data-source>non-jta-ds</non-jta-data-source>
        <mapping-file>META-INF/openejb-cmp-generated-orm.xml</mapping-file>
        <class>...</class>
        ...
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
    </persistence-unit>
</persistence>

I've reproduced this in a test, and am working on a fix. Doesn't look like
it'll be too hard. https://issues.apache.org/jira/browse/TOMEE-2295 is the
JIRA, and I'll post a PR here for review and discussion when I'm done.

Cheers

Jon

Reply via email to