You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Fay Wang (JIRA)" <ji...@apache.org> on 2009/08/19 23:05:16 UTC
[jira] Created: (OPENJPA-1256) get java.lang.ClassCastException
when IdClass contains an Enum Field
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.
[jira] Commented: (OPENJPA-1256) get java.lang.ClassCastException
when IdClass contains an Enum Field
Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Updated: (OPENJPA-1256) get java.lang.ClassCastException
when IdClass contains an Enum Field
Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-1256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Donald Woods updated OPENJPA-1256:
----------------------------------
Affects Version/s: (was: 2.0.0)
2.0.0-M2
Fix Version/s: (was: 2.0.0)
2.0.0-M3
Assignee: Fay Wang
> 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-M2
> Reporter: Fay Wang
> Assignee: Fay Wang
> Fix For: 2.0.0-M3
>
>
> 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.
[jira] Resolved: (OPENJPA-1256) get java.lang.ClassCastException
when IdClass contains an Enum Field
Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-1256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fay Wang resolved OPENJPA-1256.
-------------------------------
Resolution: Fixed
> 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.
[jira] Closed: (OPENJPA-1256) get java.lang.ClassCastException when
IdClass contains an Enum Field
Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-1256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fay Wang closed OPENJPA-1256.
-----------------------------
> 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.