Apologies for the delay, work has been hectic.

The version of OJB we are currently using is 1.0.1 and we can't upgrade to a
later version for some time.  So I'm hoping the answer isn't to do just
that.

The problem surfaces not when storing originally, that is fine, it when
updating an object loaded from the database.

The problem can be seen by using the class descriptors below and doing the
following in code:
1. Load a Parent Object from the database
2. Update the name of the child
3. Store the Parent back to the database
4. The child_id column in the parent database table is now null

The access is NOT set to anonymous on the child_id column on parent, so why
is it being stored incorrectly?

An example of the full class descriptor is:
<class-descriptor
        class="com.example.Parent"
        table="parent">
        <field-descriptor
                name="id"
                column="parent_id"
                jdbc-type="INTEGER"
                primarykey="true"
                nullable="false"
                autoincrement="true"/>
        <field-descriptor
                name="childId"
                column="child_id"
                jdbc-type="INTEGER"
                primarykey="false"
                nullable="true"/>
        <reference-descriptor
                name="child"
                class-ref="com.example.Child"
                auto-update="true"
                auto-retrieve="true"
                auto-delete="false">
                <foreignkey field-ref="childId"/>
        </reference-descriptor>
</class-descriptor>

<class-descriptor
        class="com.example.Child"
        table="child">
        <field-descriptor
                name="id"
                column="child_id"
                jdbc-type="INTEGER"
                primarykey="true"
                nullable="false"
                autoincrement="true"/>
        <field-descriptor
                name="name"
                column="name"
                jdbc-type="VARCHAR"
                primarykey="false"
                nullable="true"/>
</class-descriptor>

Cory Prowse
Analyst Programmer
InfoComp
Wollongong, Level 2, 63 Market Street
Phone: +61 (0) 2 4298 9158
email: mailto:[EMAIL PROTECTED]
http://www.infocomp.com/

 -----Original Message-----
From:   Thomas Dudziak [mailto:[EMAIL PROTECTED] 
Sent:   Friday, 8 July 2005 2:52 AM
To:     OJB Users List
Subject:        Re: Foriegn Key field not populated when
auto-retrieve="false"

Could you perhaps provide some more info, specifically the complete
class descriptor (or a comparative sample) and your usage of OJB for
storing and retrieving the object ?

Tom

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

Reply via email to