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

Wrong logging level on message issued by the fix to OPENJPA-2233

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.1, 2.1.2, 2.2.2, 2.2.1.1
    • Fix Version/s: 2.4.0
    • Component/s: Enhance
    • Labels:
    • Environment:
      OpenJPA as bundled on WebSphere 8.5.5

      Description

      Patch for issue OPENJPA-2233 introduced a message when a Embeddable entity defines an ID property, which the Enhancer can't properly add a helper method (getIDOwningClass).

      — openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java (revision 1325823)
      +++ openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java (working copy)
      @@ -1150,6 +1150,11 @@
      if (_meta.hasAbstractPKField() == true)

      { addGetIDOwningClass(); }

      +
      + if (_meta.isEmbeddedOnly()
      + && _meta.getIdentityType() == ClassMetaData.ID_APPLICATION)

      { + _log.error(_loc.get("ID-field-in-embeddable-unsupported", _meta.toString())); + }

      addNewObjectIdInstanceMethod(true);
      addNewObjectIdInstanceMethod(false);

      The problem is that this message is also emitted when inheriting from a MappedSuperClass, containing an Id field/property, which is a very common pattern.

      As the persistence engine of OpenJPA works perfectly with such a class hierarchy (and even the Enhancer with the complement of that patch just skips adding a call to the non-added helper method), it is pointless to alarm operations personnel with a message labeled and tagged as an error.

      Therefore I suggest to log it as a warning, also editing the corresponding message text to better indicate that the Enhancer will simply not add/call the helper method, skipping a potential optimization.

        Issue Links

          Activity

          Hide
          monoman Rafael Teixeira added a comment -

          Patch for 2233 introduced this problem.

          Show
          monoman Rafael Teixeira added a comment - Patch for 2233 introduced this problem.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 1551449 from Rick Curtis in branch 'openjpa/trunk'
          [ https://svn.apache.org/r1551449 ]

          OPENJPA-2463 : Change message from error to warning.

          Show
          jira-bot ASF subversion and git services added a comment - Commit 1551449 from Rick Curtis in branch 'openjpa/trunk' [ https://svn.apache.org/r1551449 ] OPENJPA-2463 : Change message from error to warning.
          Hide
          curtisr7 Rick Curtis added a comment -

          Committed a change to trunk that changes the message from error to warning.

          Show
          curtisr7 Rick Curtis added a comment - Committed a change to trunk that changes the message from error to warning.

            People

            • Assignee:
              curtisr7 Rick Curtis
              Reporter:
              monoman Rafael Teixeira
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development