Skip to Content
author's profile photo Former Member
Former Member

JDO Mapping to same object as parent/child 1:n relationship


i'm trying to do a mapping the following way:

Node (1:n) Node where the Node should have the following


getChildNodes() : Set

getParentalNode() : Node

I do have the getChildNodes mapping working, but cannot get the parental relation established due to problems with the file containing the following:

<relationship-field name="parentalNode" multiplicity="one">

<foreign-key name="NODE_TO_PARENTALNODE"



<column-pair foreign-key-column="ID"




Using this the checker complains about

javax.jdo.JDOFatalUserException: Error in mapping model of class Node: Relationship of field parentalNode: Primary key column PARENT_ID of relationship's foreign key and target class's com.vw.tpb.node.model.Node primary key columns do not match.

Well. When i do a 1:n relation to myself how should i create two primary keys then ?

Anybody some ideas on this one ?

regards, Udo

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Posted on Jul 06, 2004 at 10:50 AM

    Hi Udo,

    for the reference from child to parent, the column "ID" should be the primary key colum, whereas the column "PARENT_ID" should be the foreign key column.

    Best regards,


    Add comment
    10|10000 characters needed characters exceeded