cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dzmitry Kazimirchyk (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAY-1628) ClassCastException when using java.util.Set or java.util.Map as collection type for to-many relationship
Date Wed, 05 Oct 2011 15:14:34 GMT
ClassCastException when using java.util.Set or java.util.Map as collection type for to-many
relationship
--------------------------------------------------------------------------------------------------------

                 Key: CAY-1628
                 URL: https://issues.apache.org/jira/browse/CAY-1628
             Project: Cayenne
          Issue Type: Bug
          Components: Core Library
    Affects Versions: 3.1M3
            Reporter: Dzmitry Kazimirchyk
            Assignee: Dzmitry Kazimirchyk


ClassCastException (PersistentObjectSet to PersistentObject or PersistentObjectMap to PersistentObject)
is thrown if using java.util.Set or java.util.Map as collection type for to-many relationship:

Exception in thread "main" java.lang.ClassCastException: org.apache.cayenne.util.PersistentObjectSet
cannot be cast to org.apache.cayenne.Persistent
	at org.apache.cayenne.util.ObjectContextQueryAction.interceptObjectConversion(ObjectContextQueryAction.java:137)
	at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:97)
	at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:990)
	at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:336)
	at org.apache.cayenne.util.ObjectContextQueryAction.executePostCache(ObjectContextQueryAction.java:104)
	at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:91)
	at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:990)
	at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:979)
	at org.apache.cayenne.util.RelationshipFault.resolveFromDB(RelationshipFault.java:89)
	at org.apache.cayenne.util.PersistentObjectSet.resolvedObjectSet(PersistentObjectSet.java:237)
	at org.apache.cayenne.util.PersistentObjectSet.size(PersistentObjectSet.java:210)

When parent context intercepts relationship query and finds in its ObjectStore something which
is not List it wraps it in a List and then returns as a response. After that while transfering
result to target context it tries to cast all objects from the List to PersistentObject, so
we get ClassCastException.

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

        

Mime
View raw message