db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Jenkins <ajenk...@infocomp.com>
Subject Changes to DescriptorRepository, RepositoryXmlHandler, MtoNCollectionPrefetcher
Date Tue, 14 Sep 2004 02:20:07 GMT
Hi All,

I'm about to implement some changes on my copy here and wanted to throw them
to the lists for comment.

My dilema is explained on the mailing list email dated Mon, 13 Sep 2004,
subject 'Dynamic top class resolution?'  I want to allow the mapping file to
work with an interface, and allow a custom row reader to decide at runtime
what implementation of the interface to instantiate.  This works fine in
standard situations (saving/loading), however when you have an m:n
relationship, the top class (mapped class) of the implementor can't be
determined, so hashcodes don't map and a NullPointerException is thrown.
The top class can't be determined because the class that implements the
interface isn't mapped as an extent in the repository descriptor.  I'd like
to modify the following classes:

org.apache.ojb.broker.metadata.DescriptorRepository
org.apache.ojb.broker.metadata.RepositoryXmlHandler

I would like to add an attribute on the field descriptor which is something
like 

use-dynamic-extent="true|false"

which marks a field as able to be dynamically determined (if the other
determine strategies fail, i.e. declared extents).

A constraint on this field is that it would have to be used in conjunction
with a row-reader (and would not be used if no row reader is specified, even
if the 'use-dynamic-extent' is specified).

Changes to code would be 

a) Change to RepositoryXmlHandler and DescriptorRepository to accomodate the
extra 'use-dynamic-extent' attribute on the field-descriptor element.
b) Changes to DescriptorRepository.java, line 144, method
getTopLevelClass(Class clazz) to allow dynamic searching of
superclasses/interfaces for any classes aren't declared extents and checking
of the superclasses/interfaces against the classes that declare
'use-dynamic-extent'
c) Implementation of some kind of cache so that the superclass/interface
lookup can be kept quick.

This feature obviously has to be designed and implemented, which I'm happy
to do.  I just thought I'd throw it out there for comment first, maybe
someone has a simpler way to accomplish what I'm after.

All comments/thoughts/flames appreciated :)

Cheers
Adam

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message