Object not registered in any editingContext?
Object not registered in any editingContext?
- Subject: Object not registered in any editingContext?
- From: Ian Joyner <email@hidden>
- Date: Tue, 28 Mar 2006 09:41:50 +1100
(Sorry if this is a repost, but it has not turned up in my inbox from
last night.)
I'm intermittently getting the error:
"Cannot obtain globalId for an object which is not registered in any
editingContext"
I see quite a few have run into this one over the years and have read
all those posts. I'm using Java client, so the error is happening on
the server and being reported back to the client.
For me, this does not happen when I build and run the project from
Xcode and if I build deployment and run the app, it only happens 50%
of the time. Here is the output I am getting from inserting a simple
Person object:
[2006-03-27 16:25:13 EST] <AWT-EventQueue-0>
CronusIII.client.Person_interface_controller save editing context
com.webobjects.eocontrol.EOEditingContext@a88c32
[2006-03-27 16:25:13 EST] <AWT-EventQueue-0>
CronusIII.client.Person_interface_controller save inserted ({values =
{gender = "<com.webobjects.eocontrol.EOGenericRecord 1a30e7
_EOIntegralKeyGlobalID[Gender (java.lang.Integer)6]>"; skills = ();
date_of_birth = <com.webobjects.foundation.NSKeyValueCoding$Null>;
termination_date = <com.webobjects.foundation.NSKeyValueCoding$Null>;
creation_date = 2006-03-27 06:25:00 Etc/GMT; alias =
<com.webobjects.foundation.NSKeyValueCoding$Null>; contacts = ();
first_name = "Aadf"; title =
"<com.webobjects.eocontrol.EOGenericRecord 809883
_EOIntegralKeyGlobalID[Title (java.lang.Integer)1]>"; surname =
"Aadf"; middle_names = <com.webobjects.foundation.NSKeyValueCoding
$Null>; notes = (); addresses = (); person_type = "null"; unique_id =
<com.webobjects.foundation.NSKeyValueCoding$Null>; custom_data = ();
telephones = (); attachments = (); modification_date = 2006-03-27
06:25:00 Etc/GMT; is_a_doctor = "F"; is_a_manager = "F"; images = ();
type = "P"; email_addresses = (); }; this =
"<com.sportstec.generic.client.Person c6395b <EOTemporaryGlobalID: 0
0 -64 -88 0 7 1 0 7 -47 1 0 0 0 1 10 58 96 115 -91 -54 29 -68 -51>>"; })
[2006-03-27 16:25:13 EST] <AWT-EventQueue-0>
CronusIII.client.Person_interface_controller save updated ()
[2006-03-27 16:25:13 EST] <AWT-EventQueue-0>
CronusIII.client.Person_interface_controller save deleted ()
[2006-03-27 16:25:13 EST] <AWT-EventQueue-0>
CronusIII.client.Person_interface_controller Cannot null Server
exception: Cannot obtain globalId for an object which is not
registered in any editingContext, object:
<com.webobjects.eocontrol.EOGenericRecord 88d364 (EOEditingContext
$_EOInvalidFaultHandler aa711)>, databaseContext:
com.webobjects.eoaccess.EODatabaseContext@fceb09, object's
editingContext: null, databaseContext's active editingContext:
com.webobjects.eocontrol.EOEditingContext@989e7c
Which shows the current ec, its inserted object and no deleted or
updated objects. The ec of the bad object is indeed null (which is
different to most posts). And I'm not using nested contexts. The
offending object is an EOGenericRecord, which means it must be either
the persons title (mr, mrs, etc) or gender (male, female), however,
its address does not match those fields in the person record. The
offending EOGenericRecord also has an ec of null.
Here is related save code:
public boolean save () {
Service.log (this, " save editing context "+editingContext ());
Service.log (this, " save inserted "+editingContext
().insertedObjects());
Service.log (this, " save updated "+editingContext ().updatedObjects
());
Service.log (this, " save deleted "+editingContext ().deletedObjects
());
boolean result = super.save ();
NSNotificationCenter.defaultCenter ().postNotification
("update_contacts", null);
return result;
}
and super.save:
public boolean save () {
// Service.log (this, " saving "+state);
if (editingContext ().hasChanges ()) {
try {
editingContext ().saveChanges ();
end_operation ();
} catch (Exception x) {
Service.log (this, " Cannot " + operation + " " + x.getMessage ());
String last_operation = operation;
// Service.log (this, " saving 2 "+state);
if (state == deleting) revert (); // must do before
runErrorDialog ... seems to be a bug (in EODocumentController.save
()) if deleted object is last in table.
EODialogs.runErrorDialog ("Cannot " + last_operation, "Cannot " +
last_operation + (last_object_id != null? (" '" + last_object_id +
"'"): "") + ".\n\n" + x.getMessage () + ".");
return false;
}
}
return true;
}
Could there be any deployment settings that are causing this, since
it does not happen with the development build?
Thanks
Ian
_______________________________________________
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