Joose Vettenranta wrote:

Hi,

everything else except SuperChild is in http://joose.iki.fi/ojb/

SuperChild.java I already pasted.
repository.xml:

<descriptor-repository version="1.0" isolation-level="read-uncommitted">
<jdbc-connection-descriptor jcd-alias="test" default-connection="true" platform="PostgreSQL" subprotocol="postgresql">
<sequence-manager className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImp l"/>
</jdbc-connection-descriptor>
<class-descriptor class="net.vettenranta.Parent" table="PARENT">
<field-descriptor name="id" primarykey="true" nullable="false" default-fetch="true" autoincrement="true" column="ID" sequence-name="parent_id_seq" jdbc-type="INTEGER"/>
<field-descriptor name="name" default-fetch="true" column="NAME" jdbc-type="VARCHAR"/>
<collection-descriptor name="childs" element-class-ref="net.vettenranta.Child" auto-retrieve="true" auto-delete="true" auto-update="true">
<inverse-foreignkey field-ref="parent_id"/>
</collection-descriptor>
</class-descriptor>
<class-descriptor class="net.vettenranta.Child" table="CHILDS">
<field-descriptor name="id" primarykey="true" nullable="false" default-fetch="true" column="ID" jdbc-type="INTEGER" autoincrement="true" sequence-name="childs_id_seq" />
<field-descriptor name="parent_id" nullable="false" default-fetch="true" column="PARENT_ID" jdbc-type="INTEGER" access="anonymous"/>
<field-descriptor name="name" default-fetch="true" column="NAME" jdbc-type="VARCHAR"/>
<reference-descriptor name="parent" class-ref="net.vettenranta.Parent">
<foreignkey field-ref="parent_id" />
</reference-descriptor>
<extent-class class-ref="net.vettenranta.SuperChild" />
</class-descriptor>


<class-descriptor class="net.Vettenranta.SuperChild" table="CHILDS">
<field-descriptor name="age" default-fetch="true" column="AGE" jdbc-type="INTEGER"/>
</class-descriptor>
</descriptor-repository>

You have to specify the extent-class as the first sub-tag of class-descriptor (see http://db.apache.org/ojb/docu/guides/repository.html#class-descriptor for details).
Also, you have to duplicate all fields/references/collections from Child in SuperChild, currently they are not automatically 'inherited' in the descriptor of the sub class.


I would recommend that you use the OJB and JDO Xdoclet modules (OJB module is part of OJB, the JDO module can be downloaded from http://xdoclet.sourceforge.net/xdoclet/index.html) to generate these two files, they will make things a lot easier for you.

Tom


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to