You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Robert Zeigler <ro...@puregumption.com> on 2007/02/23 01:00:18 UTC

more XMLMappingDescriptor woes. :)

XMLMappingDescriptor chokes on decoding collections for  
CayenneDataObjects.
Cause:
	1) CayenneDataObject.readProperty returns null (instead of an empty  
list) for collection properties when the ObjectContext of the  
CayenneDataObject is null
	2) XMLMappingDescriptor is using an instanceof operator to determine  
whether a property is a collection or not.

I consider this more of a problem with the readProperty method of  
CayenneDataObject than an issue with XMLMappingDescriptor.  It would  
be nice if readProperty returned an empty list for to-many  
relationships, even when there's no data/object context.

Thoughts?

For now, I've skirted the issue by having all of my data objects  
extend a custom superclass, overriding the readProperty, and using a  
bit of reflection to return an empty ToManyList when the returned  
value is supposed to be a collection but the ObjectContext is null.  
It seems to work... but I'm not sure of the repercussions of doing  
this...?

Robert

RE: more XMLMappingDescriptor woes. :)

Posted by Kevin Menard <km...@servprise.com>.
Hi Robert,

I'm still looking at the stuff for CAY-597.  Unfortunately, I've been
stuck in a winter airport delay loop, seriously impacting what I can get
done.  I should have something in a few days though.

As for the rest of the message, if you really think it's something that
needs to be changed, open up a JIRA so we can track.  If it's something
that won't be changed, you'll know ;-)

-- 
Kevin 

> -----Original Message-----
> From: robert zeigler [mailto:robert.zeigler@gmail.com] On 
> Behalf Of Robert Zeigler
> Sent: Thursday, February 22, 2007 7:00 PM
> To: dev@cayenne.apache.org
> Subject: more XMLMappingDescriptor woes. :)
> 
> XMLMappingDescriptor chokes on decoding collections for 
> CayenneDataObjects.
> Cause:
> 	1) CayenneDataObject.readProperty returns null (instead 
> of an empty
> list) for collection properties when the ObjectContext of the 
> CayenneDataObject is null
> 	2) XMLMappingDescriptor is using an instanceof operator 
> to determine whether a property is a collection or not.
> 
> I consider this more of a problem with the readProperty 
> method of CayenneDataObject than an issue with 
> XMLMappingDescriptor.  It would be nice if readProperty 
> returned an empty list for to-many relationships, even when 
> there's no data/object context.
> 
> Thoughts?
> 
> For now, I've skirted the issue by having all of my data 
> objects extend a custom superclass, overriding the 
> readProperty, and using a bit of reflection to return an 
> empty ToManyList when the returned value is supposed to be a 
> collection but the ObjectContext is null.  
> It seems to work... but I'm not sure of the repercussions of 
> doing this...?
> 
> Robert
>