db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Braeuchi <jbraeu...@gmx.ch>
Subject Proposal to get rid of ojbConcreteClass
Date Sat, 07 Aug 2004 12:24:24 GMT
hi all,

i think we need a more flexible approach when mapping multiple classes to one 
single table. today we have the field-descriptor 'ojbConcreteClass', a working 
solution i have to admit.
the biggest problem is imo that we always store the name of the class in the 
database. this makes refactoring of the package structure unnecessarily 
difficult. another, but minor issue, is that ojbConcreteClass is an ordinary 
field-descriptor.

i propose to add some kind of concrete-selector to the class-descriptor. this 
selector points to an ordinary field-descriptor. additionaly the selector may 
have a value that is stored instead of the real class name. if no selector-value 
is defined we could still use the class name as default:

<class-descriptor
	class="org.apache.ojb.broker.ObjectRepository$A"
	table="AB_TABLE"
	selector-field-ref="my_conrete_class"	
	selector-field-value="class_a"	
 >
	<field-descriptor
          name="id"
          column="ID"
          jdbc-type="INTEGER"
          primarykey="true"
          autoincrement="true"
        	/>
        	<field-descriptor
          name="my_conrete_class"
          column="CLASS_NAME"
          jdbc-type="VARCHAR"
        	/>
	...
</class-descriptor>

as an alternative the selector could also be defined using a special element:

<class-descriptor
	class="org.apache.ojb.broker.ObjectRepository$A"
	table="AB_TABLE"
 >
	<selector-descriptor
	 field-ref="my_conrete_class"	
	 value="class_a"	
	/>

	<field-descriptor
          name="id"
          column="ID"
          jdbc-type="INTEGER"
          primarykey="true"
          autoincrement="true"
        	/>
        	<field-descriptor
          name="my_conrete_class"
          column="CLASS_NAME"
          jdbc-type="VARCHAR"
        	/>
	...
  </class-descriptor>

there's another proposal by andrew clute to include a class-selector in the 
reference-descriptor:

http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-dev@db.apache.org&msgNo=7861

actually this does not address the same problem, but we should make sure that 
the naming is consistent.

what do you think ?

jakob


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