Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] problem with remove on bidirectional oneToMany entities

christopher delahunt a écrit :
Hello Yannick,

father.getSonsCollection().remove(son);  is equivalent to

List<Son> sons = father.getSonsCollection();
sons.remove(son);
father.setSonsCollection(sons);

so entityManager.merge(father) will be required in either case if father is detached. Try em.contains(father) before the merge to see if it is managed or not. If father is a managed entity, the change to the sons collection should be picked up without the merge call.

Hi,

Indeed, I guess the problem is that "father", which was a method parameter, is indeed detached.

Best regards,

Yannick


Back to the top