You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Helen Xu (JIRA)" <ji...@apache.org> on 2012/07/17 17:40:35 UTC

[jira] [Created] (OPENJPA-2233) Failed to invoke pcGetIDOwningClass method on embeddable entity with ID annotation

Helen Xu created OPENJPA-2233:
---------------------------------

             Summary: Failed to invoke pcGetIDOwningClass method on embeddable entity with ID annotation
                 Key: OPENJPA-2233
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2233
             Project: OpenJPA
          Issue Type: Bug
          Components: Enhance
    Affects Versions: 2.2.0, 2.1.0, 2.0.1, 2.3.0
            Reporter: Helen Xu
            Assignee: Helen Xu


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));
            }



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2233) Failed to invoke pcGetIDOwningClass method on embeddable entity with ID annotation

Posted by "Helen Xu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2233?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Helen Xu updated OPENJPA-2233:
------------------------------

    Attachment:     (was: OPENJPA-2233.patch)
    
> Failed to invoke pcGetIDOwningClass method on embeddable entity with ID annotation
> ----------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2233
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2233
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: Enhance
>    Affects Versions: 2.0.1, 2.1.0, 2.2.0, 2.3.0
>            Reporter: Helen Xu
>            Assignee: Helen Xu
>
> 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));
>             }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2233) Failed to invoke pcGetIDOwningClass method on embeddable entity with ID annotation

Posted by "Jody Grassel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13459129#comment-13459129 ] 

Jody Grassel commented on OPENJPA-2233:
---------------------------------------

Checking fix into SVN on Helen's behalf.  Thanks, Helen!
                
> Failed to invoke pcGetIDOwningClass method on embeddable entity with ID annotation
> ----------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2233
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2233
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: Enhance
>    Affects Versions: 2.0.1, 2.1.0, 2.2.0, 2.3.0
>            Reporter: Helen Xu
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2233.patch
>
>
> 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));
>             }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (OPENJPA-2233) Failed to invoke pcGetIDOwningClass method on embeddable entity with ID annotation

Posted by "Helen Xu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2233?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Helen Xu updated OPENJPA-2233:
------------------------------

    Attachment: OPENJPA-2233.patch

double checked the persistence spec, the Identity field is not supported in embeddable entity. 

Changed the code to check that condition before invoke pcGetIDOwningClass. Log the user error as well.
                
> Failed to invoke pcGetIDOwningClass method on embeddable entity with ID annotation
> ----------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2233
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2233
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: Enhance
>    Affects Versions: 2.0.1, 2.1.0, 2.2.0, 2.3.0
>            Reporter: Helen Xu
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2233.patch
>
>
> 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));
>             }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2233) Failed to invoke pcGetIDOwningClass method on embeddable entity with ID annotation

Posted by "Albert Lee (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2233?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Albert Lee updated OPENJPA-2233:
--------------------------------

    Patch Info: Patch Available
    
> Failed to invoke pcGetIDOwningClass method on embeddable entity with ID annotation
> ----------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2233
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2233
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: Enhance
>    Affects Versions: 2.0.1, 2.1.0, 2.2.0, 2.3.0
>            Reporter: Helen Xu
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2233.patch
>
>
> 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));
>             }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (OPENJPA-2233) Failed to invoke pcGetIDOwningClass method on embeddable entity with ID annotation

Posted by "Helen Xu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2233?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Helen Xu updated OPENJPA-2233:
------------------------------

    Attachment: OPENJPA-2233.patch

attached fix and uni ttest
                
> Failed to invoke pcGetIDOwningClass method on embeddable entity with ID annotation
> ----------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2233
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2233
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: Enhance
>    Affects Versions: 2.0.1, 2.1.0, 2.2.0, 2.3.0
>            Reporter: Helen Xu
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2233.patch
>
>
> 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));
>             }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira