Hello.

I'am new to OpenJPA (my first project) and now i have realy big problem.
I'm writing a tool that export DB into XML and send it across network.
On another side i transformate XML into object graph and trying to persist it.

But merge does not work propertly. It is always trying to generate INSERT 
script for new object (       
although it is already exists in client database).

Simple fail example:

 RRole role = new RRole(99999l, "dasf", "df");
 rroleService.add(role);
 role = new RRole(99999l, "dasffsdf", "df");
 rroleService.update(role);

Where update:
 RRole mergedEntity = em.merge(entity);
 em.persist(mergedEntity);

It's fail with Violation of unique constraint $$: duplicate value(s) for 
column(s) 

is it way to solve my problem? If it would be select query before adding new 
entity - i'm ready for it.

Reply via email to