You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br> on 2003/02/18 19:48:35 UTC

[PROPOSAL] collection inheritance

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


Re: [PROPOSAL] collection inheritance

Posted by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br>.
I'm inheriting only collection descriptors, not reference or field
descriptors, Maybe the specification on wich descriptors to inherit on
each class would be a good thing, something like:

<class-descriptor>
  <collection-descriptor id-from-other-class="1"
			 inherit-from="myPackage.OtherClass"
  />

  <reference-descriptor  id-from-other-class="2" 			 			
inherit-from="myPackage.OtherClass"
  />
</class-descriptor>

Any suggestions ?

On Wed, 2003-02-19 at 13:28, Jakob Braeuchi wrote:
> hi leandro,
> 
> do you only inherit collection descriptors or reference- and field 
> descriptors as well ?
> maybe we should be able to specify on class-descriptor level which 
> descriptors we'd like to inherit.
> 
> just my 0.02 CHF
> 
> jakob
> 
> Leandro Rodrigo Saad Cruz wrote:
> 
> >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.
> >
> >
> >  
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
-- 
Leandro Rodrigo Saad Cruz
IT - Inter Business Tecnologia e Servicos (IB)
http://www.ibnetwork.com.br
http://jakarta.apache.org/ojb


Re: [PROPOSAL] collection inheritance

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi leandro,

do you only inherit collection descriptors or reference- and field 
descriptors as well ?
maybe we should be able to specify on class-descriptor level which 
descriptors we'd like to inherit.

just my 0.02 CHF

jakob

Leandro Rodrigo Saad Cruz wrote:

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


Re: [PROPOSAL] collection inheritance

Posted by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br>.
On Tue, 2003-02-18 at 16:02, Phil Warrick wrote:
> Leandro,
> 
> While not being a hard-core ojb developer, I would pitch in here and say 
> "yes please"!  If this could eventually be extended to all descriptors 
> it would reduce my repository size by about a factor of five and of 
> course make maintenance much less error prone...
> 
> Phil

nice ! my repository file size was greatly reduced !
if this don't go to the cvs repo, I'll send you the patch !

> 
> Leandro Rodrigo Saad Cruz wrote:
> > 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.
> > 
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
-- 
Leandro Rodrigo Saad Cruz
IT - Inter Business Tecnologia e Servicos (IB)
http://www.ibnetwork.com.br
http://jakarta.apache.org/ojb


Re: [PROPOSAL] collection inheritance

Posted by Phil Warrick <wa...@bmed.mcgill.ca>.
Leandro,

While not being a hard-core ojb developer, I would pitch in here and say 
"yes please"!  If this could eventually be extended to all descriptors 
it would reduce my repository size by about a factor of five and of 
course make maintenance much less error prone...

Phil

Leandro Rodrigo Saad Cruz wrote:
> 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.
> 
>