OpenJPA
  1. OpenJPA
  2. OPENJPA-2233

Failed to invoke pcGetIDOwningClass method on embeddable entity with ID annotation

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1, 2.1.0, 2.2.0, 2.3.0
    • Fix Version/s: 2.0.3, 2.1.2, 2.2.2, 2.2.1.1, 2.3.1, 2.4.0
    • Component/s: Enhance
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      It failed to invoke pcGetIDOwningClass method on an embeddable entity which has the ID annotation. here is the exception:

      java.lang.NoSuchMethodError: com/xxx/xxx/entity/MyClass.pcGetIDOwningClass()Ljava/lang/Class;
      at com.xxx.xxx.entity.MyClass.pcNewObjectIdInstance(MyClass.java)
      at org.apache.openjpa.enhance.PCRegistry.newObjectId(PCRegistry.java:137)
      at org.apache.openjpa.meta.MetaDataRepository.processRegisteredClass(MetaDataRepository.java:1661)
      at org.apache.openjpa.meta.MetaDataRepository.processRegisteredClasses(MetaDataRepository.java:1615)
      at org.apache.openjpa.meta.ClassMetaData.getPCSubclasses(ClassMetaData.java:365)
      at org.apache.openjpa.jdbc.meta.MappingRepository.findBaseClassMapping(MappingRepository.java:1510)
      at org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:403)
      at org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository.java:736)
      at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:625)
      at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:385)
      at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:358)
      at org.apache.openjpa.meta.MetaDataRepository.resolveAll(MetaDataRepository.java:1923)
      at org.apache.openjpa.meta.MetaDataRepository.getQueryMetaDataInternal(MetaDataRepository.java:1901)
      at org.apache.openjpa.meta.MetaDataRepository.getQueryMetaData(MetaDataRepository.java:1888)
      at org.apache.openjpa.persistence.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1013)

      This is because it uses different condition to add and invoke pcNewObjectIdInstance method in PCEnhancer.

      here is the section it adds pcNewObjectIdInstance in PCEnhancer.addPCMethods

      if (_meta.hasAbstractPKField() == true)

      { addGetIDOwningClass(); }

      here is the section it invokes pcNewObjectIdInstance in PCEnhancer.addNewObjectIdInstanceMethod

      if(_meta.isEmbeddedOnly() || _meta.hasAbstractPKField() == true)

      { code.aload().setThis(); code.invokevirtual().setMethod(PRE + "GetIDOwningClass", Class.class, null); }

      else

      { code.classconstant().setClass(getType(_meta)); }

        Issue Links

          Activity

          Helen Xu created issue -
          Helen Xu made changes -
          Field Original Value New Value
          Attachment OPENJPA-2233.patch [ 12536838 ]
          Helen Xu made changes -
          Attachment OPENJPA-2233.patch [ 12536838 ]
          Helen Xu made changes -
          Attachment OPENJPA-2233.patch [ 12536890 ]
          Albert Lee made changes -
          Patch Info Patch Available [ 10042 ]
          Albert Lee made changes -
          Fix Version/s 2.0.3 [ 12317143 ]
          Fix Version/s 2.1.2 [ 12317142 ]
          Fix Version/s 2.3.0 [ 12319463 ]
          Fix Version/s 2.2.2 [ 12323356 ]
          Fix Version/s 2.2.1.1 [ 12323484 ]
          Albert Lee made changes -
          Fix Version/s 2.3.0 [ 12319463 ]
          Albert Lee made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Albert Lee made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Rafael Teixeira made changes -
          Link This issue relates to OPENJPA-2463 [ OPENJPA-2463 ]
          Rick Curtis made changes -
          Resolution Fixed [ 1 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Assignee Helen Xu [ helenxu ] Rick Curtis [ curtisr7 ]
          Rick Curtis made changes -
          Fix Version/s 2.3.1 [ 12325297 ]
          Fix Version/s 2.4.0 [ 12325298 ]
          Rick Curtis made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Heath Thomann made changes -
          Link This issue breaks OPENJPA-2478 [ OPENJPA-2478 ]

            People

            • Assignee:
              Rick Curtis
              Reporter:
              Helen Xu
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development