On Apr 18, 2006, at 8:14 PM, Brian Rinaldi wrote:

I assume in this case the cascade delete is a setting in the config?

Only where it's really optional... it may need to be a manual thing, not auto-detected, but there will still be more situations than not where deletes cascade by requirement more than by desire because of data integrity and foreign key constraints.

Also, why would you call delete() in one case and deleteAll() in another. Wouldn't user.delete() delete one address in the case where there is a hasOne relationship and cascade is true and all records where there is a hasMany. I assume also this would work with linking tables, user.delete() would delete records in the linking table? Doug, thanks for all your continued hard work.

If you read the line carefully, it's User.getAddressIterator().deleteAll(). Internally, User.delete() would HAVE to call getAddressIterator().deleteAll() if that call were legal according to the database because there IS NO OTHER API TO DO IT other than via the gateway, to which there is no access via the Record object types. There is a getNNNIterator() for hasMany and a simple getter for a hasOne... so User.getAddress().delete() deletes a hasOne address object, whereas User.getAddressIterator().delete(x) will delete a particular object in the iterator and User.getAddressIterator().deleteAll() will delete ALL the linked records.

At least this is my understanding and seems confirmed by reading the doco I generate for my Reactor objects (see my latest blog entry for more info on generating doco for the reactor-generated objects). If I'm wrong I trust someone will correct me.

Doug? Sean?

Laterz,
J


- Brian Rinaldi

Jared Rypka-Hauer wrote:
<snippage />

-- 
Brian Rinaldi
blog - http://www.remotesynthesis.com/blog
ColdFusion Open Source List - http://www.remotesynthesis.com/cfopensourcelist
Boston ColdFusion User Group - http://www.bostoncfug.org
-- Reactor for ColdFusion Mailing List -- [email protected] -- Archives at http://www.mail-archive.com/reactor%40doughughes.net/

Reply via email to