On 3/28/08 8:47 AM, "Andrus Adamchik" <andru..bjectstyle.org> wrote:
>> One such "fix" is to disallow explicit mappings to base and sub
>> classes and
>> replace it with some other mechanism.
>
> *simultaneous* mapping that is
Correct. The conjunction there was ambiguous.
>
>> In this case, I would argue that the test case for
>> CAY-1008 has such an invalid mapping, but that the mapping for the
>> CAY-1009
>> test case does not match the criteria.
>
> Without runtime relationships in the picture this relationship loop is
> "non-redundant" I guess:
>
> BaseEntity -> DirectToSubEntity -> SubEntity
>
> This brings me to a potential runtime relationships optimization -
> avoid creation of runtime relationships that are not needed to set a
> correct FK (e.g. in a Artist -> Paintings case, toArtist is a required
> runtime relationship to set PAINTING.ARTIST_ID, while "paintingArray"
> is not). So we can probably narrow down the field to just the
> necessary runtime rels.
I think this is consistent with what I was trying to convey. Apologies if
not.
> Question... Once we do that, would that mean that we only solved 50%
> of the broken cases? Mapping cases showing remaining problems are
> welcomed.
I know that the patch I provided did fix a subset of cases for me. It did
allow the test case for CAY-1009 to pass. It also allowed tests in my own
app that's been blocked on the issue to pass. The test case for CAY-1008
still fails though, so it clearly wouldn't address the problem globally.
I think, however, that such an optimization fixes all cases except those
where there is an explicit simultaneous mapping to both base and subclasses.
My tests have mappings to two sibling classes and trimming out the runtime
parent relationship allows them to pass, so your hunch seems to be on with
regard to siblings.
At that point, if we've managed to address all cases except explicitly
mapped relationships to both the base and subclasses, is it something worth
addressing in the framework? Should we just say use the base class and cast
as appropriate? Or, if you don't want to cast, use a qualified query? Or,
should we try to fix it in Cayenne internally? I guess the last one would
be the least controversial, but I'm having a hard time thinking of a case
where it would be valid to map to both the base and subclasses at the same
time. My suspicion is that this happens more accidentally than anything
else. But, I am aware that the modeler populates such relationships itself,
so there is a notion of it being valid . . .
I'll have to chew on other mapping cases. I've only run across the problems
I have in a real development environment. So, I hadn't put much academic
thought into it yet.
-- Kevin
This archive was generated by hypermail 2.0.0 : Fri Mar 28 2008 - 09:37:14 EDT