Hi Luis,

Luis Fernando Pollo wrote:
Guys,

I've read someone state in a recent post that the "extends" attribute of class-descriptor is not used by OJB, and assume that would be the reason
for the lack of documentation in the repository metadata reference manual:

http://db.apache.org/ojb/docu/guides/repository.html#class-descriptor-N103A6

But the truth is that it *is* used. Specifically, it's purpose is to set the
"superClass" attribute of ClassDescriptor, which is then used in the
getFieldDescriptorsInHeirarchy() method of that class.

That method is what allows RowReaderDefaultImpl to map fields inherited from
a superclass to a subclass, so that you don't have to create redundant
mappings for the same properties. I think it's very important that the
documentation be adjusted to include this information, as I've seen more
than one question on the lists regarding the use of the "extends" attribute.


The code related to attribute 'extends' is really old and not thoroughly tested (there is no test case in ojb test-suite). Where do you use it - with extent-class or with "super"-references (multiple joined tables...)?

In my opinion it's not a good solution to always check in code for inherited super-fields each time the class is used, because in code we have always to split in if-else clause. Furthermore each field-descriptor is associated with it's class-descriptor, so in case of using OJB 'extent-class'-feature (don't mix it up with the 'extends' attribute ;-)) the fields returned by #getFieldDescriptorsInHierarchy are associated with different class-descriptor, thus with different DB tables - I'm not sure about the side-effects.

I think the "inheritance of fields declared in super-classes" should be handled by the metadata classes when reading the repository file. When we introduce an attribute 'allowInherit' in class-descriptor and field-descriptor element (by default it's 'true' in CLD and "undefined" in FLD), OJB will be able to inherit copies of field-descriptor instances to the sub-classes.


B.T.W. I believe there's a typo in the name of that method... :) It should
be getFieldDescriptorsInHierarchy.

In that case I completely agree ;-)

regards,
Armin



Regards,

Luis.




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to