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 a comment
10|10000 characters needed characters exceeded

Related questions

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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.