Re: Error When Deleting
Re: Error When Deleting
- Subject: Re: Error When Deleting
- From: Gustavo Pizano <email@hidden>
- Date: Sun, 10 Aug 2008 14:32:29 -0400
Hello Chuck
Thanks for the reply, indeed it worked perfectly, with that line I
understood many things. I have some questiongs, but I will redact them
good and I will let you, and the wo list know.
Thanks
Gus
On Aug 8, 2008, at 10:57 PM, Chuck Hill wrote:
On Aug 8, 2008, at 7:42 PM, Gustavo Pizano wrote:
Hello, Well Today's error its this one
java.lang.IllegalStateException: Cannot obtain globalId for an
object which is registered in an other than the databaseContext's
active editingContext, object: , databaseContext:
com.webobjects.eoaccess.EODatabaseContext@f4b65d, object's
editingContext: er.extensions.eof.ERXEC@d4ab0e, databaseContext's
active editingContext: er.extensions.eof.ERXEC@62f58e
Reason:
Cannot obtain globalId for an object which is registered in an
other than the databaseContext's active editingContext, object:
<com.nhlpm.eo.DisplayBoard pk:"1000012">, databaseContext:
com.webobjects.eoaccess.EODatabaseContext@f4b65d, object's
editingContext: er.extensions.eof.ERXEC@d4ab0e, databaseContext's
active editingContext: er.extensions.eof.ERXEC@62f58e
What im trying to do its to delete a record form the database, what
Im doing its the following:
public DisplayAll doDelete(){
ERXEC myEditingContext = (ERXEC)
session().defaultEditingContext();
myEditingContext.revert();
myEditingContext.deleteObject(displayBoard());
myEditingContext.saveChanges();
return (DisplayAll)pageWithName("DisplayAll");
}
what's going on?
I'd guess that displayBoard().editingContext() !=
session().defaultEditingContext();
Do this instead:
public DisplayAll doDelete(){
EOEditingContext myEditingContext =
displayBoard().editingContext();
myEditingContext.revert();
myEditingContext.deleteObject(displayBoard());
myEditingContext.saveChanges();
return (DisplayAll)pageWithName("DisplayAll");
}
Regards
Gustavo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden