Boa tarde pessoal,
Estou com um problema relacionado ao hibernate que gostaríamos de saber se alguém já passou por isso para poder nos ajudar.
Vou tentar exemplificar através de um código exemplo:
//objA have a list of:
//ObjB id = 1
//ObjB id = 2
//ObjB id = 3
ObjectA objA = entityManger.find(ObjectA.class, 1);
ObjectB objB = entityManger.find(ObjectB.class, 1);
objA.getObjBList().remove(objB);
new ObjectB objNewB = new ObjectB();
objNewB.setId(1);
objA.getObjtBList().add(objNewB);
// this cause the following error:
// javax.ejb.EJBTransactionRolledbackException: org.hibernate.NonUniqueObjectException:
// a different object with the same identifier value was already associated with the session:
entityManager.merge(objA);
Caso precise explicar melhor só avisar.
Obrigado.