db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ludovic Maitre (POP - Factory Part)" <lmai...@factory-part.com>
Subject Re: [repository.dtd] class-descriptor attribute 'extends' - dispensable?
Date Fri, 08 Oct 2004 08:59:53 GMT
Armin Waibel wrote:

> As said my previous posts I never used this "hidden" feature, but OJB 
> supports already inheritance and polymorphism
> http://db.apache.org/ojb/docu/guides/advanced-technique.html#Extents+and+Polymorphism

>
> http://db.apache.org/ojb/docu/guides/advanced-technique.html#Mapping+Inheritance+Hierarchies

>
>
> What kind of inheritance do you need?
>
We use inheritance on multiple tables as follow:
we have a super class (say AbstractObject) who as several fields shared 
by some of the objects of our business model. A Class Descriptor has 
been created for this class, and it is mapped to a table in database, 
ABS_OBJ for example.  The class descriptor of this class contain 
attributes for the child objects. It has a primary key, which is auto 
incremental (ble?), is name is "ID_OBJ" in db. This is a Long, or a 
INT(11) in db*.
the childs objects have the attribute "extends" set to the parent 
object, here fr.factory.bo.AbstractObject. The childs objects/classes 
have obviously different properties, so they are each stored on a 
separate db table. Their primary key is the same than the primary key of 
the parent object.
A priori, our problems was :
- that OJB didn't fetch the fields for the super class natively. We have 
do a patch for this, which most notably use getFieldsInHierarchy for 
obtain all the fields to retrieve.
- the same for the references and collection IIRC, we have also to some 
patch for this.
but perhaps we are on the wrong way...
But i'm not really clear in my explanations** so i suggest that you look 
at some samples metadata (commons-sql xml descriptor, generated sql-ddl, 
ojb class descriptor, for a parent and a child object) at the following 
page :
http://dev.factory-part.com/oss/ojb/samples/objects.html

Best regards,
Ludo

* All of our objects have an identifier of this type (this does not 
restrict the fact to have other "unique" keys stored in another 
attribute than the internal primary key). The fact that the type in db 
is different than tha type in Java has motivated the develoment of the 
patch for doing a conversion if necessary in MtoNCollectionPrefetcher, 
as described in a previous post on the user mailing list.
** This explanations are more detailed, and our patches are published, 
on http://dev.factory-part.com/oss/ojb/

>> If this is not the case, we will do a more clean implementation for 
>> OJB 1.1 of our patches that uses the extend attribute for and submit 
>> it to the community.
>> SO the community decide but there is at minimum 2 developers in the 
>> world who uses this attribute :-)
>
>
> If the "hidden extend feature" satisfy cases of inheritance that 
> couldn't be replaced by other OJB mapping configuration, we have to 
> improve OJB to support this without the "hidden extend" attribute or 
> to support this feature with docs and test cases.
>
> regards,
> Armin
>
Ok, we will take the time to do this soon, after having checked what we 
cannot do this by other ways in OJB, as you have mentionned previously. 
I'm also checking OJB 1.1 to see if it works without adaptation with our 
models.


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


Mime
View raw message