db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luis Fernando Pollo" <lpo...@indados.com.br>
Subject Re: Contribution: inheritance of field, reference and collection descriptors
Date Thu, 08 Apr 2004 17:46:52 GMT

I apologize for my lack of patience. My so-called "patch" to the repository 
XML handler ended up having undesired side-effects in other parts of OJB, 
more precisely in the SQL generation code, where the getSuperClass() method 
of ClassDescriptor is used to deduct join information and is now doing that 
incorrectly when I try to query on the base class. Please disregard the patch 
until something better has been made of it.

As Tom has accurately pointed out before, this mixture of extents related 
configuration with inheritance of descriptors from a base class does not work 
well. I like his suggestion:

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

Maybe that's the right way to go, but unfortunately I have yet to get 
acquainted with a large part of the source code (and the XDoclet stuff) 
before I can emit a serious opinion.

Anyway, as a first-time poster to the list, I'm glad my message has spawned 
an interesting discussion on the subject.


On Thu, 8 Apr 2004 16:40:23 +0200 (MET DST), Thomas Dudziak wrote
> 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 
> > exact same mappings (or even different, for that matter) as the 
> > won't be affected, since the existing mappings of the subclass override 
> > 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 
> > to copy-paste and then redundantly adjust duplicate (or triplicate, 
> > class-descriptors whenever database mappings change is just bad... It is 
> > essencial thing to have, no matter where it is provided, whether as part 
> > the extents mechanism or as attributes in the subclass descriptor, or 
> > wherever.
> Indeed. The current descriptor mechanism is more object-based than
> object-oriented.
> > You're right, the super class can only be found if it was defined prior 
> > 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 
> > (ClassDescriptor perhaps?). I thought the respository handler was the 
> > natural place to put it as I had seen other attempts in that direction 
> 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).
> Tom
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org


Luis Fernando Pollo
Analista de Desenvolvimento
Indados Soluções em Tecnologia
Salvador, BA

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

View raw message