db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc Lustig" ...@marclustig.com>
Subject AW: AW: how to tell the bo that a foreign collection must bereloaded?
Date Wed, 19 Feb 2003 15:29:56 GMT

> 4)  Deleting objects is a little trickier.  Essentially, you need to
> remove the object from collObjects, and THEN delete the object.  (The
> save() function on the parent object will NOT delete removed objects.)
> 
> So the code fragment might look like:
> 
> Person p = PersonPeer.retrieveByPK(114);
- PersonAddresss addrList = p.getPersonAddresss();
+ List addrList = p.getPersonAddresss();
> PersonAddress addr1 = addrList.get(0);
                                     ^
- addr1.remove(0);
+ addrList.remove(0);
> PersonAddressPeer.doDelete(addr1);

Many thanks. Your code would compile only with the above changes.
But still it would not work.
Am I right that this is the way you are doing the removal?

PersonAddress addr1 = getObjectToRemove
Person p = PersonPeer.retrieveByPK(114);
List addrList = p.getPersonAddresss();
addrList.remove(addrList.indexOf(addr1));
PersonAddressPeer.doDelete(addr1);

Mime
View raw message