On Dec 16, 2007, at 1:49 PM, Aristedes Maniatis wrote:
> Current EmbeddedAttribute extends Attribute, but I wonder whether it
> should be extending ObjAttribute.
I don't think it meets a criteria for inheritance, not with
ObjAttribute superclass in its current form, as EmbeddedAttribute has
no dbAtributePath.
> If it were to do so, lots of nice simplification will be had by
> having getAttributes return Collection<ObjAttribute> rather than
> Collection<Attribute> (and the equivalent for getRelationships and
> also the same for DbEntity).
Actually there is a bigger problem that prevents us from making these
simplifications. And that is "coincidental" common superclasses:
Entity, Attribute, Relationship. I.e. IMO Db* and Obj* should not be
in the same hierarchy. But changing that now with backwards
compatibility in mind is fairly non-trivial.
> If not, then there appear to be places in Cayenne which assume the
> collection just contains ObjAttributes:
>
> EntityMergeSupport.getMeaningfulFKs() (line 170)
> PrefetchProcessorJointNode (line 205)
> and more...
Correct, this assumption is no longer true.
> It does seem to me that EmbeddedAttribute should logically extend
> ObjAttribute since it is a specialised case of one. What do you think?
I don't think one should inherit from another (see above). Having a
common superclass for both may be more appropriate.
Andrus
This archive was generated by hypermail 2.0.0 : Sun Dec 16 2007 - 07:28:40 EST