db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leandro Rodrigo Saad Cruz <lean...@ibnetwork.com.br>
Subject [PROPOSAL] collection inheritance
Date Tue, 18 Feb 2003 18:48:35 GMT
Hi all, I'd like to propose ( actually commit my changes to
src/java/org/apache/ojb/broker/metadata/RepositoryXmlHandler.java )
a new feature to RepositoryXmlHandler in order to make mapping objects
to the database simpler. What I have working today makes all collection
descriptors (CLDs) available to all extent classes of a class that is
not an interface !

Example. Consider this class hierarchy :

public abstract class BaseFoo
{
	private List myCollection;
}

public class FooImpl
	extends BaseFoo
{

}

With my proposal this should map to ->

<class-descriptor class="BaseFoo">
    <extent-class class-ref="FooImpl"/>
    ...
    <collection-descriptor name="myCollection"
                           element-class-ref=""
                           auto-retrieve="true"
                           auto-update="false"
                           auto-delete="false"
                           indirection-table="SOME_TABLE"
                           >
         <fk-pointing-to-this-class column="FOO_ID"/>
         <fk-pointing-to-element-class column="SOME_CLASS_ID"/>
   </collection-descriptor>
</class-descriptor>

<class-descriptor class="FooImpl">

...  <<-- CLDs already defined :-)


</class-descriptor>

This is working only with CLDS, not reference descriptors or any other
type of descriptor.

What do you think ?

In my app, I have about 15 classes that benefit from collection
inheritance.


-- 
Leandro Rodrigo Saad Cruz
IT - Inter Business Tecnologia e Servicos (IB)
http://www.ibnetwork.com.br
http://jakarta.apache.org/ojb


Mime
View raw message