db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Armin Waibel <arm...@apache.org>
Subject Re: Contribution: inheritance of field, reference and collection descriptors
Date Thu, 08 Apr 2004 09:27:48 GMT
Hi all,

Thomas Dudziak wrote:
> 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).
>

* Think this improvement will make class-descriptor declaration 
"order-dependend".

if (m_CurrentCLD.getSuperClass() != null) {
 >                             ClassDescriptor superCLD = 
m_repository.getDescriptorFor(m_CurrentCLD.getSuperClass());

The super class can only be found if the super class-descriptor was read 
by the xml-parser before the sub class-descriptor. Such a restriction is 
unduly in my opinion. Or do I overlook something?
So I agree with Tom, that we should rethink the metadata stuff for 1.1.

regards,
Armin

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

---------------------------------------------------------------------
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