Joose Vettenranta wrote:

Hi,

I'm having problems on using extent-class and extending java-classes..

I have like this:

class SuperChild extends Child {
 private int age;
 // getters and setters
}

class Child {
 private int id;
 private Parent parent;
 private String name;

 ....
}

and in jdo-file I have:
<class name="SuperChild" identity-type="datastore" persistence-capable-superclass="net.vettenranta.Child">
<field name="age" persistence-modifier="persistent">
<extension vendor-name="ojb" key="column" value="age" />
</field>
</class>


and it goes OK enhancing.

repository.xml:
<class-descriptor class="net.vettenranta.SuperChild" table="child">
<extent-class class-ref="net.vettenranta.Child" />
<field-descriptor name="age" nullable="false" default-fetch="true" column="age" jdbc-type="INTEGER" />
</class-descriptor>


and result is:

org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: Can not init Identity for given object [EMAIL PROTECTED]

What could be wrong?

The extent-class tag is a bit counter-intuitive because it specifies the opposite direction of the Java extends/implements. So if you put


<extent-class class-ref="net.vettenranta.SuperChild" />

into the class descriptor for Child, you should be fine.

Tom


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



Reply via email to