[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[eclipselink-users] problem with remove on bidirectional oneToMany entities
|
- From: Yannick Majoros <yannick.majoros@xxxxxxxxxxxx>
- Date: Tue, 18 Aug 2009 16:33:44 +0200
- Delivered-to: eclipselink-users@eclipse.org
- Organization: UCLouvain
- User-agent: Thunderbird 2.0.0.22 (Windows/20090605)
Hi,
We have two entity classes, Father and Son
We are in an EJB environment, transactions are managed automatically.
When a son is removed, we used to do this:
father.getSonsCollection().remove(son);
entityManager.remove(son);
It seems that the cache gets corrupted if we don't do this after those
two lines:
entityManager.merge(father);
Is this right? I would think it isn't, "father" should be automatically
updated (in cache, thus).
Or should I write this:
List<Son> sons = father.getSonsCollection();
sons.remove(son);
father.setSonsCollection(sons);
without entityManager.merge(fatcher)
Thanks,
Yannick Majoros