users@glassfish.java.net

Re: entity relation mappings - parent key voilated error

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Wed, 28 Jan 2009 12:53:12 -0800

How did you setup relationship between the 3?

thanks,
-marina

glassfish_at_javadesktop.org wrote:
> Guys,
>
> I have three tables as follows:
>
> Table1
> _______
> ID | R_ID
>
> Table 2
> _______
> ID
>
> Table3
> _______
> ID
>
> Now Table1->R_ID is mapped to Table2->ID and
> Table2 -> ID is mapped to Table3 -> ID
>
> R_ID is a generated by a Sequence in the Table1 entity...And I want it to be reflected the same in the Table2 and Table3. Thats the reason, I added foreign key constraint as shown above
>
> Now when ever I do
> em.persist(table1);
> em.persist(table2);
> em.persist(table3);
>
> I am getting parent key not found error...what am I doing wrong...is there something wrong with my database design
>
> -Amor
> [Message sent by forum member 'amorous' (amorous)]
>
> http://forums.java.net/jive/thread.jspa?messageID=328773
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>