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

Internal field mappings reference incorrect fields when @MappedSuperclass class is not included as managed entity in persistence.xml

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2.0
    • Fix Version/s: None
    • Component/s: Enhance
    • Labels:
      None
    • Environment:
      Mac OS X 10.7.3, Java 1.6.0_31, OpenJPA 2.2.0, JavaDB/Derby 10.5.3.0

      Description

      If an abstract entity class (marked as @MappedSuperclass) is extended by a concrete entity class and the abstract entity is not include in the persistence.xml as a managed class, OpenJPA incorrectly maps the entity fields.

      Based on the SQL trace messages, it would appear that there are two different internal arrays representing the entity fields. The StateManagerImpl._metafield contains an array of all fields on the given entity. However, when the actual field data is fetched, a different backing array of fields is used and it does not match the _metafield array. As a result, the wrong field is updated/fetched.

      Attached is a simple maven/junit test case.

        Attachments

        1. openjpa-2177.zip
          13 kB
          Mike Goldner

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mgoldner Mike Goldner
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: