On 12/29/05, Manukyan, Sergey <[EMAIL PROTECTED]> wrote:

> Here is my case: (I am using OJB 1.0.3)
>
> <class-descriptor class="Parent">
>
> <field-descriptor name="firstName" column="... " jdbc-type="VARCHAR"
> primarykey="true" />
>             <field-descriptor name="lastName" column="..."
> jdbc-type="VARCHAR" primarykey="true" />
>
>       <collection-descriptor
>             name="allChildren"
> collection-class="org.apache.ojb.broker.util.collections.ManageableArray
> List"
>                         element-class-ref="Child">
>                         <inverse-foreignkey field-ref="lastName" />
>             </collection-descriptor>
> </class-descriptor>
>
> <class-descriptor class="Child">
> <field-descriptor name="firstName" column="..." jdbc-type="VARCHAR"
> primarykey="true" />
>             <field-descriptor name="lastName" column="..."
> jdbc-type="VARCHAR" primarykey="true" />
> </class-descriptor>

The problem, I think, is that the Parent class has a primary key
consisting of two columns but the collection specifies only one
inverse-foreignkey. You need there the same number of foreign key
columns as the targeted class (Parent since it is a collection and
thus works with back-references from the element class) has primary
key columns, and in the same order regarding types etc..
Btw, you should perhaps not use a primary key field of Child because
OJB will update it automatically upon writing the collection (when
auto-update=link/object/true). In general it is better to define
separate columns for the foreign keys.

Tom

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

  • is it a bug? Manukyan, Sergey
    • Re: is it a bug? Thomas Dudziak

Reply via email to