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 09:15:52 GMT
On Wed, 7 Apr 2004, Luis Fernando Pollo wrote:

> All,
> 
> I've patched org.apache.ojb.broker.metadata.RepositoryXmlHandler so that it 
> would automatically include field, reference and collection descriptors of a 
> superclass (specified via the "extends" attribute of the class descriptor) 
> into a subclass' own class descriptor.
> 
> Since I've seen quite a few posts on the users list regarding this 
> (apparently pending) feature, I thought it might be of use to you.
> 
> The repository handler now checks, at the end of the class-descriptor tag, 
> whether the mapped class has a superclass ("extends=someClass" is present). 
> If it does, the handler will include all mappings defined in the superclass 
> that have NOT YET BEEN DEFINED in the subclass (this is so a subclass can 
> override mappings).
> 
> The attached diff was generated from a comparison against RC6.
> 
> Hope it'll be useful.

Certainly useful, though there are two things about inheriting feature
descriptors that bug me:

* From an usability point of view, it will be required to have
non-inheritance (i.e. as it is currently) as the default. Otherwise,
almost all existing repository descriptors will probably break. To
circumvent this, there could be an attribute at the class descriptor like
inheritBaseDescriptors='true' (with false as the default). This could even
be more fine-grained (inheritBaseFields or similar).

* From a design point of view, inheriting descriptors from the base class
does not go along well with the current extent mechanism because they are
opposite in direction. Since the current extent mechanism is not natural
to java programmers anyway, there should perhaps be a redesign of it
(i.e. using an 'extends' just like in java). This however can only be done
for the 1.1 or later as it is a major change to the repository descriptor
definition (breaks compatibility).

Tom


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


Mime
View raw message