Hi All,
I have played with this all day and managed to find one work-around but I can't
really live with it for long - I hope I'm just missing something in my config
but I can't work out what:
I have four entities, a grandparent, two parents (each with many-to-one with the
grandparent) and one grandchild (related many-to-one to both parents). (And all
are bi-directional).
OpenJPA 1.2 is having problems ordering the inserts and updates when I'm adding
new entities and seems to ignore my metadata.
Despite setting nullable=false insertable=true updatable=false on the grandchild
join-column definition, I see grandchild is inserted first without the parent
foreign keys and then next the parent is inserted, after which OpenJPA issues an
UPDATE on the grandchild. This breaks the referential integrity constraints when
the INSERT executes.
Perhaps the cascading is important? I have tried cascading only through one
parent from grandparent to grandchild, and then through the other, and also by
allowing both to cascade (cascade-all) but only one configuration works which is
when I'm persisting everything. If I try it with an existing grandparent, I
can't get it to work.
Thanks in advance for any help
Adam