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

Improved error information for unenhanced classes.

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.1.1, 2.2.0
    • Component/s: Enhance, jpa
    • Labels:
      None

      Description

      The exception message issued by openjpa 2.0 for the use of an unenhanced class is not as useful as the message issued by the 1.x versions. In 2.0, the following message is received:

      <openjpa-2.0.0-r422266:935683 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Attempt to cast instance "org.apache.sample.entities.Book@97781f" to PersistenceCapable failed. Ensure that it has been enhanced.
      FailedObject: org.apache.sample.entities.Book@97781f

      While the same application run using openjpa 1.x gives this message:

      <openjpa-1.2.1-r752877:753278 fatal user error> org.apache.openjpa.persistence.ArgumentException: No metadata was found for type "class org.apache.sample.entities.Book". The class does not appear in the list of persistent types: [org.apache.geronimo.sample.entities.Book].

      The 2.0 message no longer points to the persistence.xml definition as the potential source of error. It should give some possible solutions to "Ensure that is has been enhanced". Perhaps something like "Ensure that the class is included in the list of persistent types or enhanced as part of the application build".

        Issue Links

          Activity

          Hide
          curtisr7 Rick Curtis added a comment -

          I ran a testcase with unenhanced classes on 2.1.x and here is the output:

          172 test_2 WARN [main] openjpa.Enhance - Unenhanced classes were detected even though the enhancer has ran. Ensure that the EntityManagerFactory is created prior to creating any Entities.
          172 test_2 WARN [main] openjpa.Enhance - This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "
          org.apache.openjpa.Person
          ...
          ".

          I believe this issue has already been resolved. Please reopen if you'd like to see some other information in the message.

          Show
          curtisr7 Rick Curtis added a comment - I ran a testcase with unenhanced classes on 2.1.x and here is the output: 172 test_2 WARN [main] openjpa.Enhance - Unenhanced classes were detected even though the enhancer has ran. Ensure that the EntityManagerFactory is created prior to creating any Entities. 172 test_2 WARN [main] openjpa.Enhance - This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: " org.apache.openjpa.Person ... ". I believe this issue has already been resolved. Please reopen if you'd like to see some other information in the message.
          Hide
          allee8285 Albert Lee added a comment -

          Close issue in preparation for 2.2.0 release.

          Show
          allee8285 Albert Lee added a comment - Close issue in preparation for 2.2.0 release.

            People

            • Assignee:
              curtisr7 Rick Curtis
              Reporter:
              rickmcguire Rick McGuire
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development