I just doing this:
ParentObj parent = dao.get(ParentObj.class, id);
ChildObj child = new ChildObj();
child.setId(childId);
parent.getChildCollection().remove(child);
dao.save(parent);
Thanks!
----- Original Message -----
From: "Dale Newfield" <d...@newfield.org>
To: <users@appfuse.dev.java.net>
Sent: Thursday, November 05, 2009 6:38 PM
Subject: Re: [appfuse-user] Hibernate collections
On Thu, Nov 5, 2009 at 4:29 PM, Oscar Rodriguez
<orodrigu...@speedy.com.ar> wrote:
Hi, sorry if this list is not the correct place to ask this, but when I
want
to update a collection (insert or remove an item) hibernate first remove
all
items from database and then insert the items in the collection, I don't
understand why.
Depends on how you update that collection. If you're replacing the
List/Set/etc. with a new List/Set/etc. it doesn't have much choice.
If you take the one with which your object was populated and call
.add(), .remove(), etc on it there's a chance it can be smarter.
-Dale
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net
E-mail clasificado por el Idenfificador de Spam Inteligente.
Para modificar la categoría clasificada acceda a su webmail
Este mensaje ha sido verificado por el E-mail Protegido.
Antivirus actualizado en 05/11/2009 / Versión: 0.95.2/9994
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net