db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <to...@first.gmd.de>
Subject Re: Contribution: inheritance of field, reference and collection descriptors
Date Thu, 08 Apr 2004 14:40:23 GMT

On Thu, 8 Apr 2004, Luis Fernando Pollo wrote:

> Hi,
> Hmm... Am I overlooking something obvious here? The way I look at it, 
> existing repository descriptors where the old-fashioned copy-and-paste 
> tecnique was used to create the class-descriptors of subclasses that have the 
> exact same mappings (or even different, for that matter) as the superclass 
> won't be affected, since the existing mappings of the subclass override those 
> of the superclass.

Not necessarily as it depends on the implementation of the repository xml
parser. I can imagine that currently it would balk about two field
descriptors having the same name.
Also, the point is that it is not unusual that slight variations exist for
subclasses (e.g. one field is not included). And in this case you
certainly don't want inheritance.
> Agree. The thing is that the lack of a mechanism to free the user from having 
> to copy-paste and then redundantly adjust duplicate (or triplicate, or...) 
> class-descriptors whenever database mappings change is just bad... It is an 
> essencial thing to have, no matter where it is provided, whether as part of 
> the extents mechanism or as attributes in the subclass descriptor, or 
> wherever.

Indeed. The current descriptor mechanism is more object-based than
> You're right, the super class can only be found if it was defined prior to 
> the subclass definition in the XML repository. That doesn't seem too 
> inappropriate to me, though. The only way to get around this restriction 
> would be to include the field/reference/collection inheritance code elsewhere 
> (ClassDescriptor perhaps?). I thought the respository handler was the most 
> natural place to put it as I had seen other attempts in that direction before.

This IMO should not be handled directly by the repository xml parser, but
by the metadata classes themselves (ClassDescriptor etc.), as otherwise we
won't be able to use inheritance when defining the repository description
at runtime. And in the metadata it is probably easier, anyway, as a
ClassDescriptor only has to be aware of its base class descriptor in order
to use the features of it.

Interestingly there is some convergence with the metadata part of the
OJB XDoclet module (which does this stuff already).

To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org

View raw message