openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fay Wang (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-1256) get java.lang.ClassCastException when IdClass contains an Enum Field
Date Wed, 19 Aug 2009 21:35:14 GMT

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

Fay Wang commented on OPENJPA-1256:
-----------------------------------

The specific ClassCastException is:

java.lang.ClassCastException: BType cannot be cast to 
org.apache.openjpa.util.ObjectId
   
test.EntityB.pcCopyKeyFieldsToObjectId(EntityB.java) 
org.apache.openjpa.enhance.PCRegistry.copyKeyFieldsToObjectId(PCRegistry.java:172)

org.apache.openjpa.util.ApplicationIds.fromPKValues(ApplicationIds.java:219)  

org.apache.openjpa.jdbc.meta.ClassMapping.getObjectId(ClassMapping.java:216)
   
org.apache.openjpa.jdbc.meta.ClassMapping.getObjectId(ClassMapping.java:147)
   
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:934)
   
org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:280)
   
org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2349)
org.apache.openjpa.jdbc.meta.strats.RelationToManyInverseKeyFieldStrategy.loadElement(RelationToManyInverseKeyFieldStrategy.java:87)
org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy.load(StoreCollectionFieldStrategy.java:554)
    org.apache.openjpa.jdbc.meta.FieldMapping.load(FieldMapping.java:919)
   
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:641)
   
org.apache.openjpa.kernel.DelegatingStoreManager.load(DelegatingStoreManager.java:116)
    org.apache.openjpa.kernel.ROPStoreManager.load(ROPStoreManager.java:78)
   
org.apache.openjpa.kernel.StateManagerImpl.loadFields(StateManagerImpl.java:3035)
   
org.apache.openjpa.kernel.StateManagerImpl.loadField(StateManagerImpl.java:3113)
   
org.apache.openjpa.kernel.StateManagerImpl.beforeAccessField(StateManagerImpl.java:1606)
   


> get java.lang.ClassCastException when IdClass contains an Enum Field
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-1256
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1256
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.0.0
>            Reporter: Fay Wang
>             Fix For: 2.0.0
>
>
> Suppose EntityA and EntityB are defined as follows:
> @Entity
> class EntityA {
>    @Id
>     int id;
>   
>    @OneToOne(fetch=fetchType=LAZE)
>    EntityB entityB;
>    
>    ...
> }
> @Entity
> @IdClass(BId.class)
> class EntityB {
>     @Id
>     int intId;
>    @Id
>     BType bType;
> ...
>     public enum BType { A1, A2, A3, A4 };
>      ...
> }
> ClassCast Exception is thrown in the following situation:
>     EntityA a = em.find(EntityA.class, 1)
>     EntityB b = a.getEntityB();

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


Mime
View raw message