I have a JPA program where EclipseLink is the Persistence provider. When I merge an user entity, change its ID, and try to merge the same user instance again, an error is thrown
This answer is 4 years late but anyway.
You can update it by executing regular update queries using SQL or JPQL or Criteria API. I find the last one is the best.
Here is a code example that can do the trick. I have tried it in a similar situation and it works fine with EclipseLink.
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaUpdate cu = cb.createCriteriaUpdate(User.class);
Root c = cu.from(User.class);
cu.set(User_.id, newId).where( cb.equal(c.get(User_.id), oldId) );
em.createQuery(cu).executeUpdate();
Instead of User_.id you can pass the name of the field as a String e.g. "id".
Another example http://www.thoughts-on-java.org/criteria-updatedelete-easy-way-to/