cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAY-1834) Exception: ToManyList cannot be cast to DataObject
Date Tue, 18 Jun 2013 11:19:20 GMT

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

Andrus Adamchik updated CAY-1834:
---------------------------------

    Attachment: 0001-xx.patch

Attaching a patch that ports your schema to Cayenne unit tests... The problem (as is the case
in 99% of situations when some odd relationships are misbehaving) is in "runtime" relationships
in Cayenne. So this Cayenne patch fixes it:

--- a/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/DataDomainProvider.java
+++ b/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/DataDomainProvider.java
@@ -193,7 +193,7 @@ public class DataDomainProvider implements Provider<DataDomain>
{
         }
 
         dataDomain.getEntityResolver().applyDBLayerDefaults();
-        dataDomain.getEntityResolver().applyObjectLayerDefaults();
+        //dataDomain.getEntityResolver().applyObjectLayerDefaults();
 
         for (DataNodeDescriptor nodeDescriptor : descriptor.getNodeDescriptors()) {
             DataNode dataNode = new DataNode(nodeDescriptor.getName());


Feel free to create a custom DataDomainProvider with this change and bind it via DI... On
the Cayenne end we'll probably need to get rid of "runtime" obj relationships. But that's
something that will require more research.
                
> 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
>         Attachments: 0001-xx.patch, VisionsMap.map.xml
>
>
> 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

Mime
View raw message