Sebastian Laag created OPENJPA-2424:
---------------------------------------

             Summary: Classes are enhanced multiple times in a multi 
persistence-unit project
                 Key: OPENJPA-2424
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2424
             Project: OpenJPA
          Issue Type: Bug
          Components: Enhance
    Affects Versions: 2.2.2
         Environment: Windows 7
JDK 1.7
Maven 3.0.5
            Reporter: Sebastian Laag


We use the above environment to build our project. We use the 
openjpa-maven-plugin for the enhancement of the JPA classes. The 
persistence.xml configures 4 persistence-units for different database 
connections. Every persistence-unit defines own classes and uses the 
exclude-unlisted-classes Tag, because we only want every class to be enhanced 
only once.

Now if we execute mvn install every defined class will be enhanced 4 times. The 
persistence.xml looks like this.

<persistence xmlns="http://java.sun.com/xml/ns/persistence";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
    http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";
        version="2.0">
        <persistence-unit name="db1">
                <class>ClassA</class>

                <exclude-unlisted-classes>true</exclude-unlisted-classes>

                <properties>
                      ...some properties for the connection...
                </properties>
        </persistence-unit>

        <persistence-unit name="db2">
                <class>ClassB</class>

                <exclude-unlisted-classes>true</exclude-unlisted-classes>

                <properties>
                      ...some properties for the connection...
                </properties>
        </persistence-unit>

        <persistence-unit name="db3">
                <class>ClassC</class>

                <exclude-unlisted-classes>true</exclude-unlisted-classes>

                <properties>
                      ...some properties for the connection...
                </properties>
        </persistence-unit>


        <persistence-unit name="db4">
                <class>ClassD</class>

                <exclude-unlisted-classes>true</exclude-unlisted-classes>

                <properties>
                      ...some properties for the connection...
                </properties>
        </persistence-unit>
</persistence>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to