Below is an example of my reposity.
if i call broker.store(B) bother records for A and B get created fine. When I store C I get a message saying pk is not valid for C. I think when validating the PK for see it should get the auto-increment from A, but it does not. If i set the pk myself it exceptions out trying to add null value to C.id which is odd. If i set auto-increment=true on B then all three classes get store but with different pk's.
7 WARN [main] root -
org.apache.ojb.broker.PersistenceBrokerException: assertValidPkFields failed for Object of type: C on insert
at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown Source)
-----------------------
<class-descriptor
class="A"
table="A_TABLE"
>
<field-descriptor id="1"
name="Id"
column="ID"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
/>
<field-descriptor id="2"
name="aValue"
column="A_VALUE"
jdbc-type="VARCHAR"
/>
</class-descriptor><class-descriptor
class="B"
table="B_TABLE"
>
<field-descriptor id="1"
name="Id"
column="ID"
jdbc-type="INTEGER"
primarykey="true"
/>
<field-descriptor id="2"
name="bValue"
column="B_VALUE"
jdbc-type="VARCHAR"
/>
<reference-descriptor
name="super"
class-ref="A"
auto-update="true"
>
<foreignkey field-ref="Id"/>
</reference-descriptor>
<extent-class class-ref="A"/>
</class-descriptor>
<class-descriptor
class="C"
table="C_TABLE"
>
<field-descriptor id="1"
name="Id"
column="ID"
jdbc-type="INTEGER"
primarykey="true"
/>
<field-descriptor id="2"
name="cValue"
column="C_VALUE"
jdbc-type="VARCHAR"
/>
<reference-descriptor
name="super"
class-ref="B"
auto-update="true"
>
<foreignkey field-ref="Id"/>
</reference-descriptor>
<extent-class class-ref="B"/>
</class-descriptor>
Hello Chris,
-----Original Message-----
From: Christopher C Worley [mailto:[EMAIL PROTECTED]
Still having problems with this. I have a question about defining extents. In the below explination would C be the only class I would have to define the extent classes for or would it be in A?
In the situation C extends B extends A you need:
<class-descriptor class="C"> <extent-class class-ref="B"/> </class-descriptor>
<class-descriptor class="B"> <extent-class class-ref="A"/> </class-descriptor>
I have been successfull at handling mapping extents (two classes to two tables). Whe I add a third class I get "assertValidPkFields failed for Object of type..." error.
What is the precise message text?
is null so it updates the referenceFKs. When it does this it only looks at the B reference which is null. So, I get this error. I
Which B reference?
Can you explain more detailed?
Olli
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
