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

Enhancer yields "does not have a public no-args constructor." exception for entity with protected qualified constructor

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.1, 2.1.2, 2.2.3, 2.3.0
    • Fix Version/s: None
    • Component/s: Enhance
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      Entity with protected qualified constructor:

      @Entity
      public class Kunde {
      ....
      protected Kunde()

      { // jpa constructor }

      ....
      }

      causes enhancer to fail with message like:

      C:\>wsenhancer test\Kun*.class
      82 ConstructorDemoWeb INFO [main] openjpa.Tool - Enhancer running on type "class at.arz.domain.core.Kunde".
      Exception in thread "main" <openjpa-2.2.3-SNAPSHOT-r422266:1485013 fatal user error> org.apache.openjpa.util.MetaDataException: The id class "class test.Kundennummer"
      specified by type "class test.Kunde" does not have a public no-args constructor.
      at org.apache.openjpa.meta.ClassMetaData.validateAppIdClassMethods(ClassMetaData.java:2161)
      at org.apache.openjpa.meta.ClassMetaData.validateAppIdClass(ClassMetaData.java:2067)
      at org.apache.openjpa.meta.ClassMetaData.validateIdentity(ClassMetaData.java:2034)
      at org.apache.openjpa.meta.ClassMetaData.validateMeta(ClassMetaData.java:1946)
      at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1807)
      at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:828)
      at org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java:725)
      at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:649)
      at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:417)
      at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:388)
      at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:286)
      at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4885)
      at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4831)
      at org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4801)
      at org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:761)
      at org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:751)
      at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4796)
      at org.apache.openjpa.enhance.PCEnhancer.main(PCEnhancer.java:4787)
      Caused by: java.lang.NoSuchMethodException: test.Kundennummer.<init>()
      at java.lang.Class.throwNoSuchMethodException(Class.java:327)
      at java.lang.Class.getConstructor(Class.java:354)
      at org.apache.openjpa.meta.ClassMetaData.validateAppIdClassMethods(ClassMetaData.java:2159)
      ... 17 more

        Attachments

        1. OPENJPA-2403.patch
          0.7 kB
          Albert Lee

          Activity

            People

            • Assignee:
              allee8285 Albert Lee
              Reporter:
              allee8285 Albert Lee
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: