db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc Lustig" ...@marclustig.com>
Subject AW: how to generate removeObject() methods? (was: AW: how to tellthe bo that a foreign collection must be reloaded?)
Date Wed, 19 Feb 2003 16:15:42 GMT
[I sent this email 20 mins ago, due to some strange reason it didn't get
distributed, at least not to me.]

> 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, Peter. 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();

View raw message