You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Jurgen Doll (JIRA)" <ji...@apache.org> on 2013/06/10 20:16:22 UTC

[jira] [Updated] (CAY-1834) Exception: ToManyList cannot be cast to DataObject

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

Jurgen Doll updated CAY-1834:
-----------------------------

    Description: 
I have an entity called Activity with a M-N relationship to ActivityResults (No middle or linking table).
The relationship getResults() returns a MAP<name,ActivityResults>, but the exception also occurs when using a List<ActivityResults>.

I have found that selecting "To Many" on the dbEntity backing the child class (ActivityResults) produces the exception. While switching "To Many" off removes the exception and commits succesfully.

If an existing ActivityResult is modified and the Activity is then committed the updates related to the ActivityResults are "successful", but rolled back as an exception is thrown when post-processing Activity:

java.lang.ClassCastException: org.apache.cayenne.access.ToManyList cannot
be cast to org.apache.cayenne.DataObject
	at
org.apache.cayenne.reflect.generic.DataObjectBaseProperty.toDataObject(DataObjectBaseProperty.java:97)
	at
org.apache.cayenne.reflect.generic.DataObjectBaseProperty.readPropertyDirectly(DataObjectBaseProperty.java:70)
	at
org.apache.cayenne.reflect.generic.DataObjectToManyProperty.isFault(DataObjectToManyProperty.java:106)
	at
org.apache.cayenne.access.DataDomainSyncBucket.postprocess(DataDomainSyncBucket.java:257)



  was:
I have an entity called Activity with a M-N relationship to ActivityResults (No middle or linking table).
The relationship getResults() returns a MAP<name,ActivityResults>, but the exception also occurs when using a List<ActivityResults>.

I have found that selecting "To Many" on the dbEntity backing the child class (ActivityResults) produces the exception. While switching "To Many" off removes the exception and commits succesfully.

If an existing ActivityResult is modified and the Activity is then committed the exception produced is:

java.lang.ClassCastException: org.apache.cayenne.access.ToManyList cannot
be cast to org.apache.cayenne.DataObject
	at
org.apache.cayenne.reflect.generic.DataObjectBaseProperty.toDataObject(DataObjectBaseProperty.java:97)
	at
org.apache.cayenne.reflect.generic.DataObjectBaseProperty.readPropertyDirectly(DataObjectBaseProperty.java:70)
	at
org.apache.cayenne.reflect.generic.DataObjectToManyProperty.isFault(DataObjectToManyProperty.java:106)
	at
org.apache.cayenne.access.DataDomainSyncBucket.postprocess(DataDomainSyncBucket.java:257)



    
> Exception: ToManyList cannot be cast to DataObject
> --------------------------------------------------
>
>                 Key: CAY-1834
>                 URL: https://issues.apache.org/jira/browse/CAY-1834
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 3.1B2
>            Reporter: Jurgen Doll
>            Priority: Blocker
>
> I have an entity called Activity with a M-N relationship to ActivityResults (No middle or linking table).
> The relationship getResults() returns a MAP<name,ActivityResults>, but the exception also occurs when using a List<ActivityResults>.
> I have found that selecting "To Many" on the dbEntity backing the child class (ActivityResults) produces the exception. While switching "To Many" off removes the exception and commits succesfully.
> If an existing ActivityResult is modified and the Activity is then committed the updates related to the ActivityResults are "successful", but rolled back as an exception is thrown when post-processing Activity:
> java.lang.ClassCastException: org.apache.cayenne.access.ToManyList cannot
> be cast to org.apache.cayenne.DataObject
> 	at
> org.apache.cayenne.reflect.generic.DataObjectBaseProperty.toDataObject(DataObjectBaseProperty.java:97)
> 	at
> org.apache.cayenne.reflect.generic.DataObjectBaseProperty.readPropertyDirectly(DataObjectBaseProperty.java:70)
> 	at
> org.apache.cayenne.reflect.generic.DataObjectToManyProperty.isFault(DataObjectToManyProperty.java:106)
> 	at
> org.apache.cayenne.access.DataDomainSyncBucket.postprocess(DataDomainSyncBucket.java:257)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira