Re: How to delete an EO?
Re: How to delete an EO?
- Subject: Re: How to delete an EO?
- From: Chuck Hill <email@hidden>
- Date: Sat, 17 Apr 2004 08:47:06 -0700
public WOComponent deleteRecord()
{
userRecord().editingContext().deleteObject(userRecord());
userRecord().editingContext().saveChanges();
return null;
}
Looks correct to me. Are you getting an exception or error message?
What happens? If you are not seeing an exception or error then
something someplace else is wrong.
Chuck
On Apr 16, 2004, at 9:49 PM, Bill Reynolds wrote:
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.
_______________________________________________
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.