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 "TINE Houari (OBJECTIVA)" <ho...@ca-cedicam.fr> on 2003/03/14 13:34:11 UTC

inheritance, extent and cleaner reference

Hi,

I finished ameliorations of OJB that consist of 

1. eliminating fk from 1-1 reference between objects.
2. implement inheritance as 1-1 reference.
3. eliminating the obligation of declaring the attribute ojbConcreteClass in
extent class.

The idea consists of introducing the concept of anonymous field descriptor
and anonymous persitent field.

case1: A reference B through a 1-1 relation
class A {
  int id;
  B refB;
}

class B {
  int id;
  String attribute;
}

Class descriptor for A will be declared like this:

<class-descriptor class="A" table="TABLE_A">
	<field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER"
primarykey="true" autoincrement="true" />
	<field-descriptor id="2" name="" column="ID_B" jdbc-type="INTEGER"
/>
	<reference-descriptor name="refB" class-ref="B" auto-update="true">
		<foreignkey field-id-ref="2" />
	</reference-descriptor>
</class-descriptor>

NOTICE that the name of field 2 is "".
-----------------------------------

Amelioration allow to handle referenced object B without having a fk in A.

Case 2: X inherits from Y
class Y {
  int id;
  String AttributeY;
}

class X extends Y {
  String AttributeX;
}

Class descriptor for X will be declared like this:

<class-descriptor class="X" table="TABLE_X">
	<field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER"
primarykey="true" autoincrement="true" />
	<field-descriptor id="2" name="" column="ID_Y" jdbc-type="INTEGER"
/>
	<reference-descriptor name="" class-ref="B" auto-update="true">
		<foreignkey field-id-ref="2" />
	</reference-descriptor>
</class-descriptor>

NOTICE that the name of field 2 is "" and the name of reference-descriptor
is ""
----------------------------------------------------------------------------
----

Amelioration allow to handle base object Y as a reference-descriptor.


Case3: extent

abstract class U {
  int id;
}

class V extends U {
  ...
}

class W extends U {
  ...
}

The class descriptor is not changed but the amelioration don't need an
attribute ojbConcreteClass to handle objects.


How it works:
I have introduced 
  - AnonymousFieldDescriptor,
  - AnonymousPersistendField,
  - AnonymousPersistendFieldForInheritance,
  - AnonymousObjectReferenceDescriptor,
  - AnonymousFKValue and
  - AnonymousObjConcreteClassValue

and some modifications in the class RepositoryXmlHandler. That's all.

What do you think.

Houar TINE


Re: inheritance, extent and cleaner reference

Posted by Thomas Mahler <th...@web.de>.
Hi all,

Jakob Braeuchi wrote:
> hi,
> 
> i like the idea of 'anonymous' fields but imo we should no longer stick 
> to field-ids.

I agree!

> i propose to have some kind of  fielddescriptor that does not  need a 
> field in the object. may be it should be named column-descriptor.
> 
> <class-descriptor class="A" table="TABLE_A">
>    <field-descriptor name="id" column="ID" jdbc-type="INTEGER"
> primarykey="true" autoincrement="true" />
>    <column-descriptor name="id_b" column="ID_B" jdbc-type="INTEGER"
> />
>    <reference-descriptor name="refB" class-ref="B" auto-update="true">
>        <foreignkey field-ref="id_b" />
>    </reference-descriptor>
> </class-descriptor>
> 
> what do think ?

makes a lot of sense to me!

Thomas

> jakob
> 
> Thomas Mahler wrote:
> 
>> Hi Houar TINE,
>>
>> All three feature sound like real improvements.
>> Especially 1. and 2. have been requested several times by users. It 
>> would be great to integrate your stuff into the codebase!
>>
>> Just post it to the list, we will review it!
>>
>> thanks for your contribution,
>> Thomas
>>
>>
>> TINE Houari (OBJECTIVA) wrote:
>>
>>> Hi,
>>>
>>> I finished ameliorations of OJB that consist of
>>> 1. eliminating fk from 1-1 reference between objects.
>>> 2. implement inheritance as 1-1 reference.
>>> 3. eliminating the obligation of declaring the attribute 
>>> ojbConcreteClass in
>>> extent class.
>>>
>>> The idea consists of introducing the concept of anonymous field 
>>> descriptor
>>> and anonymous persitent field.
>>>
>>> case1: A reference B through a 1-1 relation
>>> class A {
>>>   int id;
>>>   B refB;
>>> }
>>>
>>> class B {
>>>   int id;
>>>   String attribute;
>>> }
>>>
>>> Class descriptor for A will be declared like this:
>>>
>>> <class-descriptor class="A" table="TABLE_A">
>>>     <field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER"
>>> primarykey="true" autoincrement="true" />
>>>     <field-descriptor id="2" name="" column="ID_B" jdbc-type="INTEGER"
>>> />
>>>     <reference-descriptor name="refB" class-ref="B" auto-update="true">
>>>         <foreignkey field-id-ref="2" />
>>>     </reference-descriptor>
>>> </class-descriptor>
>>>
>>> NOTICE that the name of field 2 is "".
>>> -----------------------------------
>>>
>>> Amelioration allow to handle referenced object B without having a fk 
>>> in A.
>>>
>>> Case 2: X inherits from Y
>>> class Y {
>>>   int id;
>>>   String AttributeY;
>>> }
>>>
>>> class X extends Y {
>>>   String AttributeX;
>>> }
>>>
>>> Class descriptor for X will be declared like this:
>>>
>>> <class-descriptor class="X" table="TABLE_X">
>>>     <field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER"
>>> primarykey="true" autoincrement="true" />
>>>     <field-descriptor id="2" name="" column="ID_Y" jdbc-type="INTEGER"
>>> />
>>>     <reference-descriptor name="" class-ref="B" auto-update="true">
>>>         <foreignkey field-id-ref="2" />
>>>     </reference-descriptor>
>>> </class-descriptor>
>>>
>>> NOTICE that the name of field 2 is "" and the name of 
>>> reference-descriptor
>>> is ""
>>> ---------------------------------------------------------------------------- 
>>>
>>> ----
>>>
>>> Amelioration allow to handle base object Y as a reference-descriptor.
>>>
>>>
>>> Case3: extent
>>>
>>> abstract class U {
>>>   int id;
>>> }
>>>
>>> class V extends U {
>>>   ...
>>> }
>>>
>>> class W extends U {
>>>   ...
>>> }
>>>
>>> The class descriptor is not changed but the amelioration don't need an
>>> attribute ojbConcreteClass to handle objects.
>>>
>>>
>>> How it works:
>>> I have introduced   - AnonymousFieldDescriptor,
>>>   - AnonymousPersistendField,
>>>   - AnonymousPersistendFieldForInheritance,
>>>   - AnonymousObjectReferenceDescriptor,
>>>   - AnonymousFKValue and
>>>   - AnonymousObjConcreteClassValue
>>>
>>> and some modifications in the class RepositoryXmlHandler. That's all.
>>>
>>> What do you think.
>>>
>>> Houar TINE
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 



Re: inheritance, extent and cleaner reference

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

i like the idea of 'anonymous' fields but imo we should no longer stick 
to field-ids.
i propose to have some kind of  fielddescriptor that does not  need a 
field in the object. may be it should be named column-descriptor.

<class-descriptor class="A" table="TABLE_A">
    <field-descriptor name="id" column="ID" jdbc-type="INTEGER"
primarykey="true" autoincrement="true" />
    <column-descriptor name="id_b" column="ID_B" jdbc-type="INTEGER"
/>
    <reference-descriptor name="refB" class-ref="B" auto-update="true">
        <foreignkey field-ref="id_b" />
    </reference-descriptor>
</class-descriptor>

what do think ?

jakob

Thomas Mahler wrote:

> Hi Houar TINE,
>
> All three feature sound like real improvements.
> Especially 1. and 2. have been requested several times by users. It 
> would be great to integrate your stuff into the codebase!
>
> Just post it to the list, we will review it!
>
> thanks for your contribution,
> Thomas
>
>
> TINE Houari (OBJECTIVA) wrote:
>
>> Hi,
>>
>> I finished ameliorations of OJB that consist of
>> 1. eliminating fk from 1-1 reference between objects.
>> 2. implement inheritance as 1-1 reference.
>> 3. eliminating the obligation of declaring the attribute 
>> ojbConcreteClass in
>> extent class.
>>
>> The idea consists of introducing the concept of anonymous field 
>> descriptor
>> and anonymous persitent field.
>>
>> case1: A reference B through a 1-1 relation
>> class A {
>>   int id;
>>   B refB;
>> }
>>
>> class B {
>>   int id;
>>   String attribute;
>> }
>>
>> Class descriptor for A will be declared like this:
>>
>> <class-descriptor class="A" table="TABLE_A">
>>     <field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER"
>> primarykey="true" autoincrement="true" />
>>     <field-descriptor id="2" name="" column="ID_B" jdbc-type="INTEGER"
>> />
>>     <reference-descriptor name="refB" class-ref="B" auto-update="true">
>>         <foreignkey field-id-ref="2" />
>>     </reference-descriptor>
>> </class-descriptor>
>>
>> NOTICE that the name of field 2 is "".
>> -----------------------------------
>>
>> Amelioration allow to handle referenced object B without having a fk 
>> in A.
>>
>> Case 2: X inherits from Y
>> class Y {
>>   int id;
>>   String AttributeY;
>> }
>>
>> class X extends Y {
>>   String AttributeX;
>> }
>>
>> Class descriptor for X will be declared like this:
>>
>> <class-descriptor class="X" table="TABLE_X">
>>     <field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER"
>> primarykey="true" autoincrement="true" />
>>     <field-descriptor id="2" name="" column="ID_Y" jdbc-type="INTEGER"
>> />
>>     <reference-descriptor name="" class-ref="B" auto-update="true">
>>         <foreignkey field-id-ref="2" />
>>     </reference-descriptor>
>> </class-descriptor>
>>
>> NOTICE that the name of field 2 is "" and the name of 
>> reference-descriptor
>> is ""
>> ----------------------------------------------------------------------------
>> ----
>>
>> Amelioration allow to handle base object Y as a reference-descriptor.
>>
>>
>> Case3: extent
>>
>> abstract class U {
>>   int id;
>> }
>>
>> class V extends U {
>>   ...
>> }
>>
>> class W extends U {
>>   ...
>> }
>>
>> The class descriptor is not changed but the amelioration don't need an
>> attribute ojbConcreteClass to handle objects.
>>
>>
>> How it works:
>> I have introduced   - AnonymousFieldDescriptor,
>>   - AnonymousPersistendField,
>>   - AnonymousPersistendFieldForInheritance,
>>   - AnonymousObjectReferenceDescriptor,
>>   - AnonymousFKValue and
>>   - AnonymousObjConcreteClassValue
>>
>> and some modifications in the class RepositoryXmlHandler. That's all.
>>
>> What do you think.
>>
>> Houar TINE
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>


Re: inheritance, extent and cleaner reference

Posted by Thomas Mahler <th...@web.de>.
Hi Houar TINE,

All three feature sound like real improvements.
Especially 1. and 2. have been requested several times by users. It 
would be great to integrate your stuff into the codebase!

Just post it to the list, we will review it!

thanks for your contribution,
Thomas


TINE Houari (OBJECTIVA) wrote:
> Hi,
> 
> I finished ameliorations of OJB that consist of 
> 
> 1. eliminating fk from 1-1 reference between objects.
> 2. implement inheritance as 1-1 reference.
> 3. eliminating the obligation of declaring the attribute ojbConcreteClass in
> extent class.
> 
> The idea consists of introducing the concept of anonymous field descriptor
> and anonymous persitent field.
> 
> case1: A reference B through a 1-1 relation
> class A {
>   int id;
>   B refB;
> }
> 
> class B {
>   int id;
>   String attribute;
> }
> 
> Class descriptor for A will be declared like this:
> 
> <class-descriptor class="A" table="TABLE_A">
> 	<field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER"
> primarykey="true" autoincrement="true" />
> 	<field-descriptor id="2" name="" column="ID_B" jdbc-type="INTEGER"
> />
> 	<reference-descriptor name="refB" class-ref="B" auto-update="true">
> 		<foreignkey field-id-ref="2" />
> 	</reference-descriptor>
> </class-descriptor>
> 
> NOTICE that the name of field 2 is "".
> -----------------------------------
> 
> Amelioration allow to handle referenced object B without having a fk in A.
> 
> Case 2: X inherits from Y
> class Y {
>   int id;
>   String AttributeY;
> }
> 
> class X extends Y {
>   String AttributeX;
> }
> 
> Class descriptor for X will be declared like this:
> 
> <class-descriptor class="X" table="TABLE_X">
> 	<field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER"
> primarykey="true" autoincrement="true" />
> 	<field-descriptor id="2" name="" column="ID_Y" jdbc-type="INTEGER"
> />
> 	<reference-descriptor name="" class-ref="B" auto-update="true">
> 		<foreignkey field-id-ref="2" />
> 	</reference-descriptor>
> </class-descriptor>
> 
> NOTICE that the name of field 2 is "" and the name of reference-descriptor
> is ""
> ----------------------------------------------------------------------------
> ----
> 
> Amelioration allow to handle base object Y as a reference-descriptor.
> 
> 
> Case3: extent
> 
> abstract class U {
>   int id;
> }
> 
> class V extends U {
>   ...
> }
> 
> class W extends U {
>   ...
> }
> 
> The class descriptor is not changed but the amelioration don't need an
> attribute ojbConcreteClass to handle objects.
> 
> 
> How it works:
> I have introduced 
>   - AnonymousFieldDescriptor,
>   - AnonymousPersistendField,
>   - AnonymousPersistendFieldForInheritance,
>   - AnonymousObjectReferenceDescriptor,
>   - AnonymousFKValue and
>   - AnonymousObjConcreteClassValue
> 
> and some modifications in the class RepositoryXmlHandler. That's all.
> 
> What do you think.
> 
> Houar TINE
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
>