On Mar 29, 2008, at 3:16 PM, Kevin Menard wrote:

Essentially, what I'm seeing is that there is not a 1:1 correlation between
relationships and their reverses.

True. A very good point. From what I can tell this may be another way to tell what "redundant relationships" are.

In the case described both relationships are equally valid reverse relationships. I wouldn't even call the situation ambiguous - it is just two clearly defined relationships instead of one like we assumed in the past.

So where do we go from here? There are two ways: we either change the API to reflect 1:N natire of reverse relationship (and deal with it everywhere throught the framework, e.g by setting multiple reverse relationships inside CayenneDataObject, etc.) or disallow redundant mapping explicitly. Either way it is a good idea to acknowledge this scenario explicitly in some way, so that users know what they are dealing with.

A lazy person in me votes for the later option. Or maybe not that lazy? I always liked my object graph structure to avoid any inconsistency (e.g. assume relationship cardinality that DB does not enforce) and redundancy (e.g. RelatedEntity double relationships over the same set of joins). So mentally I never allowed myself to map anything like that, and never felt the need to do so. So maybe we shouldn't enable this scenario, complicating the framework significantly, just because we can?

Andrus

Reply via email to