[ 
https://issues.apache.org/jira/browse/OPENJPA-953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12678831#action_12678831
 ] 

Fay Wang commented on OPENJPA-953:
----------------------------------

This problem is about the inheritance of entities and their respective IdClass. 
The following scenarios are attempted to narrow down the problem:

(1) abstract parent P (Entity) <-- child C
    parentId PId <-- childId CId
==> Exception: java.lang.ArrayIndexOutOfBoundsException: Array index out of 
range: 2
        at 
org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.retrieve
        (ApplicationIds.java:679)

(2) abstract parent P (MappedSuperClass) <-- child C
      parentId PId <-- childId CId
==> works fine

(3) concrete parent P (Entity) <-- child C
      parentId PId <-- childId CId
==> org.apache.openjpa.util.MetaDataException: Primary key fields can only be 
declared in base persistent classes that also declare their identity-type to be 
"application".
        at org.apache.openjpa.meta.ClassMetaData.validateNoPKFields
       (ClassMetaData.java:2069)

Case (1) is reported by Mike in this JIRA.  It appears that openjpa does not 
properly handle the IdClass inheritance when parent class is an abstract class, 
but annotated as Entity. The proposed solutions could be: 
(a) throw an exception as in case (3)
(b) make it work as in case (2)

Any suggestion?

> ArrayIndexOutOfBoundsException in 
> org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.retrieve
> --------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-953
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-953
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Vorburger
>         Attachments: test-jpa2.0.zip
>
>
> As per the email thread "ArrayIndexOutOfBoundsException in 
> org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.retrieve" on 
> [email protected] yesterday (see 
> http://n2.nabble.com/ArrayIndexOutOfBoundsException-in-org.apache.openjpa.util.ApplicationIds%24PrimaryKeyFieldManager.retrieve-tt2417570.html#a2417570),
>  there is a confirmed (Fay Wang) openjpa bug when using  application ID 
> Identity Hierarchies as per 
> http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/manual/jpa_overview_pc_identity.html#jpa_overview_pc_identity_hierarchy,
>  may be because I was trying to use them together with Entities as Identity 
> Fields as per
> http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/manual/ref_guide_pc_oid.html#ref_guide_pc_oid_entitypk.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to