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] Resolved: (OPENJPA-1028) ClassCastException during findBy when embeddable is involved
Date Fri, 10 Apr 2009 23:22:14 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-1028?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Fay Wang resolved OPENJPA-1028.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0

> ClassCastException during findBy when embeddable is involved
> ------------------------------------------------------------
>
>                 Key: OPENJPA-1028
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1028
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>            Reporter: Fay Wang
>            Assignee: Fay Wang
>             Fix For: 2.0.0
>
>
> Caused by: java.lang.ClassCastException: myFvt.EmbedA incompatible with myFvt.EntityA
> 	at myFvt.EntityB.pcReplaceField(EntityB.java)
> 	at org.apache.openjpa.kernel.StateManagerImpl.replaceField(StateManagerImpl.java:3083)
> 	at org.apache.openjpa.kernel.StateManagerImpl.storeObjectField(StateManagerImpl.java:2512)
> 	at org.apache.openjpa.kernel.StateManagerImpl.storeObject(StateManagerImpl.java:2502)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setMappedBy(JDBCStoreManager.java:453)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:384)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:289)
> 	at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111)
> 	at org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
> 	at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:995)
> 	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:953)
> This ClassCastException occurred in the following test scenario:
> (1) 
> @Entity
> public class EntityA implements Serializable {
>     @Id
>     Integer id;
>    @Embedded
>     EmbedA embedA;
> ...
> }
> (2) 
> @Embeddable
> public class EmbedA {
>    
>     @OneToOne(mappedBy="a", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
>     EntityB entityB;
>     
> ...
> }
> (3)
> @Entity
> public class EntityB {
>     
>     @Id
>     protected int id;
>     @OneToOne
>     private EntityA a;
> ...
> }
> (4) test case:
>         EntityManager em = emf.createEntityManager();
>         EntityA a = em.find(EntityA.class, 1);

-- 
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