Two entities link with ONE_TO_ONE ASSOCIATION

Good morning,
I have two entities (Ent1 e Ent2) linked together with ASSOCIATION ONE_TO_ONE. I have first Ent1Edit where ther is a button that opens the Ent2Edit. When I create the Ent2Edit and save the Ent2 from its Edit, automatically the system create the Ent1 too. So when I try to save the Ent1 in the main edit Ent1Edit the system returns the error of PRIMARY_KEY in the Ent1, because it was already created before when I saved the related entity Ent2.

How can I resolve this issue?
Thank you very much in advance.

Hi @infonuvola2015,
Which entity is the owner of the relationship? Given your description, I think Ent1 should have a composition 1-1 to Ent2 and not an association.


Good morning,
Ent1 (Art) has a composition relationship with Ent2 (ArtScheda)
while Ent2 (ArtScheda) has a association with Ent1 (Art)
owning side is ArtScheda.
I am available for other clarifications.
Thank you.

It’s hardly possible to help you without having code samples.
A small demo project reproducing the problem would be ideal.

I would also recommend you to go through this guide:
to train yourself with editing association and composition relationships.

1 Like