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

Reply via email to