Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-78

Automatic runtime enhancement only works when the class is listed in the first persistence-unit

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • 1.1.0
    • kernel
    • None

    Description

      When multiple persistence-units are defined in the persistence.xml, only the first one is examined when looking for classes to enhance when using the automatic runtime enhancement (e.g., using the "-javaagent:openjpa.jar" argument). So if the project uses the following persistence.xml:

      <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
      <persistence-unit name="unit1" transaction-type="RESOURCE_LOCAL">
      <class>unit1.SomeClass</class>
      </persistence-unit>
      <persistence-unit name="unit2" transaction-type="RESOURCE_LOCAL">
      <class>unit2.SomeClass</class>
      </persistence-unit>
      </persistence>

      In this example, when unit1.SomeClass is loaded, it will be enhanced, but unit2.SomeClass won't ever be enhanced.

      The only workaround is to list all of your persistent classes in an initial entry in the persistence-unit.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mprudhom Marc Prud'hommeaux
              Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: