I think the problem here is that you're creating a new RRole Entity instead
of updating a detached Entity. When you call em.merge() on a new entity it
operates in the same manner as em.persist(). One way to resolve the problem
is to make sure you're dealing with a detached or managed copy of the entity
before calling merge().

Something like this might work.

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

// I'm assuming some other work takes place here
// If you still have access to the original role then
// you can omit the em.find() call below.

role = em.find(RRole.class, 99999l);

role.setString1 ("dasffsdf");
rroleService.update(role);

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

Hope this helps,
-Mike

On Nov 19, 2007 4:41 AM, Luc1fer Hell <[EMAIL PROTECTED]> wrote:

> A have to add, that i don't use generated annotation on id's.
> And exception throws on merge, it doesn't execute persist.
>
>

Reply via email to