How to delete an EO?
How to delete an EO?
- Subject: How to delete an EO?
- From: Bill Reynolds <email@hidden>
- Date: Fri, 16 Apr 2004 21:49:16 -0700
This has got to be one of those "so simple it will make me feel stupid"
questions (but I'll ask anyway).
Below is the code from a component. It's pretty simple, there's a single
variable that contains an EO ("userRecord"). I can use it's editingContext
to update it and that all works great.
I've created a function for 'deleting' the object and I can't seem to find
the right way to go about it. As you can see in my deleteRecord() function
below I've tried just about every combination, but I can't delete my
'userRecord' object from the database.
What the heck am I doing?
Much appreciation,
-Bill
public class AdminEditRegUser extends WOComponent {
protected RegUsers userRecord;
public AdminEditRegUser(WOContext context) {
super(context);
}
public WOComponent deleteRecord()
{
//userRecord().editingContext().deleteObject(userRecord);
userRecord().editingContext().deleteObject(userRecord());
userRecord().editingContext().saveChanges();
//EOEditingContext ec = session().defaultEditingContext();
//EOEditingContext ec = userRecord().editingContext();
//ec.deleteObject(userRecord());
//ec.saveChanges();
return null;
}
public WOComponent updateRecord()
{
if(onMailingsChecked == 0)
{
userRecord.setON_MAILINGS("0");
}else{
userRecord.setON_MAILINGS("1");
}
if(needsFollowupChecked == 0)
{
userRecord.setFOLLOW_UP("0");
}else{
userRecord.setFOLLOW_UP("1");
}
userRecord().editingContext().saveChanges();
return null;
}
}
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.