Hi Steve,
please
- remove the "id" and "field-id-ref" attributes (we recommend to use name based references).
- declare all FK in reference descriptors when using compound PK. ProductVO has two PK fields (productId and productType), so in class PartVO you need two FK fields to establish a unique association with ProductVO (you only declare "productId", add a "productType" too).
Declare all FK fields in the collection-descriptor of "parts", so you have to add a inverse-foreignkey pointing to "productType" field in PartVO.
or if productId in Product is unique, don't declare productType as PK.
regards, Armin
SteveWarder wrote:
Hi , I am working on a web application using Tomcat4 , Mysql and OJB. I've recently upgraded from OJB 1.0.rc3 to OJB v1.0.1 and my previously working unidirectional 1:n mapping no longer works with the auto-retreive settings.
I've been through all the new documentation and seem to have everything as it should be . I've included the relevent mappings from my repositry_user.xml file.
Both classes have all the relevant setter and getter methods defined. This relationship used to work perfectly in rc3.
I guess I must be missing something obvious but at the moment I can't see what it is .
Any suggestions / ideas or solutions would be gratefully recieved.
<class-descriptor class="com.rivertek.catalog.data.ProductVO" table="product">
<field-descriptor id="1" name="productID" column="productID" jdbc-
type="INTEGER" primarykey="true" autoincrement="true" />
<field-descriptor id="2" name="productType" column="productType" jdbc-
type="VARCHAR" primarykey="true" />
<field-descriptor id="3" name="name" column="name" jdbc-type="VARCHAR" />
<field-descriptor id="4" name="shortDesc" column="shortDesc" jdbc-
type="VARCHAR" />
<field-descriptor id="5" name="imageURL" column="imageURL" jdbc-
type="VARCHAR" />
<collection-descriptor name="parts" collection-
class="org.apache.ojb.broker.util.collections.ManageableVector" element-class-ref="com.rivertek.catalog.data.PartVO" auto-retrieve="true" auto-update="object" auto-delete="object">
<inverse-foreignkey field-id-ref="6" field-ref="productID"/>
</collection-descriptor>
</class-descriptor>
<class-descriptor class="com.rivertek.catalog.data.PartVO" table="part">
<field-descriptor id="1" name="partID" column="partID" jdbc-type="INTEGER" primarykey="true" autoincrement="true"/>
<field-descriptor id="2" name="partType" column="partType" jdbc-
type="VARCHAR" primarykey="true" />
<field-descriptor id="3" name="name" column="name" jdbc-type="VARCHAR" />
<field-descriptor id="4" name="shortDesc" column="shortDesc" jdbc-
type="VARCHAR" />
<field-descriptor id="5" name="imageURL" column="imageURL" jdbc-
type="VARCHAR" />
<field-descriptor id="6" name="productID" column="productID" jdbc-
type="INTEGER" />
</class-descriptor>
--------------------------------------------------------------------- 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]
