Every Person may have PersonContactable which is basically set of "ways to contact person" (e.g. phone number) - there is other types of contactable profiles in system, but this does not matter now. Every person can also may have collection of contacts and collection of relatives. UserContact entity, essentially, is record in one's contacts list. PersonToPersonLink keep link between two persons (e.g. relative). I have two Person instances, lets say Person1 and Person2. Person2 is already in Persons1's relstiveLinks collection (all data in database already). Then I take Person1, add new UserContact that points to Person2 PersonContactableProfile and also add new PhoneContactInfo to PersonContactableProfile of Person2 - I've got exception described above while saving Person1 graph (entityManager.merge(Person2)).

While investigating that issue i've found out why it happening - PhoneContactInfo instance added to cloneMapping collection of UnitOfWorkImpl twice!
First time during mapping traversal through contacts collection and second time during mapping traversal through relativeLinks collection. I do not understand if it's a bug? I also find out that line in MergeManager source code (trunk):

Addition of second copy of PhoneContactInfo to cloneMapping collection happening exactly during existence check.

Can someone tell me how I can fix this behaviour?]]>Rodion Missing name2012-07-04T17:48:29-00:00Re: Very strange &quot;primary key [null]&quot; validation exceptionhttps://www.eclipse.org/forums/index.php/mv/msg/366888/893755/#msg_893755
How are you adding the new PhoneContactInfo to the existing PersonContactableProfile? And how is Person2 read in?

]]>Rodion Missing name2012-07-05T15:34:36-00:00Re: Very strange &quot;primary key [null]&quot; validation exceptionhttps://www.eclipse.org/forums/index.php/mv/msg/366888/894772/#msg_894772
Also try removing the creation of the UserContact from the code to see if it is affecting the merge. It may be some cyclic issue.
]]>James Sutherland2012-07-10T13:19:50-00:00Re: Very strange &quot;primary key [null]&quot; validation exceptionhttps://www.eclipse.org/forums/index.php/mv/msg/366888/894814/#msg_894814
Quote:

Can you set the log level to finest.

Here is my log. Previous wasn't really with FINEST level because I miss one place where log level is actually was set.

Also try removing the creation of the UserContact from the code to see if it is affecting the merge. It may be some cyclic issue.

If I don't create UserContact along with PhoneContactInfo it work like a charm - i.e. only UserContact and only PhoneContactInfo both works perfectly. This is some cyclic issue indeed, not like exactly "cyclic" but more like existence of several pathes through graph to same entity.
]]>Rodion Missing name2012-07-10T15:56:59-00:00Re: Very strange &quot;primary key [null]&quot; validation exceptionhttps://www.eclipse.org/forums/index.php/mv/msg/366888/895377/#msg_895377
Rodion Missing name2012-07-12T15:38:04-00:00Re: Very strange &quot;primary key [null]&quot; validation exceptionhttps://www.eclipse.org/forums/index.php/mv/msg/366888/899659/#msg_899659
Also try change the merge cascade on your UserContact contactable to cascade the merge and persist.