Cascade question

1 view
Skip to first unread message

muccy

unread,
Mar 16, 2009, 9:25:05 AM3/16/09
to sqlitepersistentobjects-user
Hi.
I'm using this library on iPhone OS 2.2.1.

I have to report a strange behaviour...
I have two classes.

Product {
NSDate *expires;
Item *item;
}

Item {
NSString *name;
}

If I delete an instance of Product class as follows (or using other
equivalent methods):
[Product deleteObject:[aProduct pk] cascade:NO];
the bound Item object will be deleted...also if I clearly specified
CASCADE:NO.

So...I've seen the implementation of deleteObject:cascade:, and I read
what follows:
if (isCollectionType(className)) {
...
}
else {
Class propClass = objc_lookUpClass([className UTF8String]);
if ([propClass isSubclassOfClass:[SQLitePersistentObject class]])
{
id theProperty = [self valueForKey:prop];
[theProperty deleteObjectCascade:TRUE];
}
}

Why a subclass of SQLitePersistentObject overrides my cascade
preference?
I corrected the if statement, but maybe I misunderstood your
purpose...

Thank you very much...
Marco
Reply all
Reply to author
Forward
0 new messages