Hi all,

just wanting to clarify the do's/don'ts...

I'm getting "Cannot obtain globalId for an object which is registered in an other than the databaseContext's active editingContext..."

Okay, my understanding is that you ought _not_ have relationships going from a shared entity to a non-shared entity. Fine, so when the application starts up I've got some code that removes any such relations from the entities as they are registered (but leaving intact the relations from the non-shared to the shared). This allows me to specify an array property of "SharedEntities" relevant to that application.

Now according to the api, I can create a regular editing context, fetch the object into it, change it and save and that'll be all there is to it. Nice theory.

I'm actually not needing to change that object but am setting the relationship from a non-shared entity to the shared one. However the exception I'm an exception that's preventing me from saving the context.

// Okay so I'm creating a editing context for editing like so:
public MyEditingContext editingContext() {
        if ( _wec == null ) {
                _wec = new MyEditingContext( clientForRequest( 
context().request() );
                _wec.setSharedEditingContext( null );
                _wec.setStopsValidationAfterFirstError( false );
        }
}

// and in the awakeFromInsertion(EOEditingContext) I'm doing the following:
{
        if has reverse relation
                // Note: this is where it's useful Mike :-)
                addObjectToBothSidesOfRelationshipWithKey( aClient, key );
        else
                takeValueForKey( aClient, key );
}

Any ideas? What have I missed?
Thanks muchly...

with regards,
--

Lachlan Deck


[2007-04-19 15:57:53 EST] <WorkerThread14> <com.webobjects.appserver._private.WOComponentRequestHandler>: Exception occurred while handling request: java.lang.RuntimeException: <WOLongResponsePage> Exception occurred in long response thread: com.webobjects.foundation.NSForwardException [java.lang.IllegalStateException] Cannot obtain globalId for an object which is registered in an other than the databaseContext's active editingContext
<...>
[2007-04-19 15:57:53 EST] <WorkerThread14> java.lang.RuntimeException: <WOLongResponsePage> Exception occurred in long response thread: com.webobjects.foundation.NSForwardException [java.lang.IllegalStateException] Cannot obtain globalId for an object which is registered in an other than the databaseContext's active editingContext, object: {values = {webServicesPass = "**"; collegeDomains = "<com.webobjects.eocontrol._EOCheapCopyMutableArray 3228a1 (<EOAccessArrayFaultHandler collegeDomains _EOIntegralKeyGlobalID[College (java.lang.Long)3]>)>"; promotions = "<com.webobjects.eocontrol._EOCheapCopyMutableArray 278e83 (<EOAccessArrayFaultHandler promotions _EOIntegralKeyGlobalID[College (java.lang.Long)3]>)>"; created = 2006-06-23 07:45:05 Etc/GMT; modified = 2006-06-23 07:45:05 Etc/GMT; name = "Some name"; sites = "<com.webobjects.eocontrol._EOCheapCopyMutableArray 1a5ec6c (<EOAccessArrayFaultHandler sites _EOIntegralKeyGlobalID[College (java.lang.Long)3]>)>"; courses = "<com.webobjects.eocontrol._EOCheapCopyMutableArray 61cd2 (<EOAccessArrayFaultHandler courses _EOIntegralKeyGlobalID[College (java.lang.Long)3]>)>"; isDeleted = false; nationalProviderCode = <com.webobjects.foundation.NSKeyValueCoding$Null>; messageTemplates = "<com.webobjects.eocontrol._EOCheapCopyMutableArray 5dfaf1 (<EOAccessArrayFaultHandler messageTemplates _EOIntegralKeyGlobalID [College (java.lang.Long)3]>)>"; preferences = "<com.webobjects.eocontrol._EOCheapCopyMutableArray fd66a5 (<EOAccessArrayFaultHandler preferences _EOIntegralKeyGlobalID [College (java.lang.Long)3]>)>"; courseClasses = "<com.webobjects.eocontrol._EOCheapCopyMutableArray 1ef7de4 (<EOAccessArrayFaultHandler courseClasses _EOIntegralKeyGlobalID [College (java.lang.Long)3]>)>"; categories = "<com.webobjects.eocontrol._EOCheapCopyMutableArray 10980e7 (<EOAccessArrayFaultHandler categories _EOIntegralKeyGlobalID[College (java.lang.Long)3]>)>"; webServicesLogin = "iscd"; rooms = "<com.webobjects.eocontrol._EOCheapCopyMutableArray 44d990 (<EOAccessArrayFaultHandler rooms _EOIntegralKeyGlobalID[College (java.lang.Long)3]>)>"; courseSessions = "<com.webobjects.eocontrol._EOCheapCopyMutableArray 14e4e31 (<EOAccessArrayFaultHandler courseSessions _EOIntegralKeyGlobalID [College (java.lang.Long)3]>)>"; subcategories = "<com.webobjects.eocontrol._EOCheapCopyMutableArray b85c17 (<EOAccessArrayFaultHandler subcategories _EOIntegralKeyGlobalID [College (java.lang.Long)3]>)>"; tutors = "<com.webobjects.eocontrol._EOCheapCopyMutableArray 1b5391b (<EOAccessArrayFaultHandler tutors _EOIntegralKeyGlobalID[College (java.lang.Long)3]>)>"; webServicesSecurityCode = <com.webobjects.foundation.NSKeyValueCoding$Null>; }; this = "<com.ish.willow.college.model.College 7e8c4d _EOIntegralKeyGlobalID [College (java.lang.Long)3]>"; }, databaseContext: [EMAIL PROTECTED], object's editingContext: [EMAIL PROTECTED], databaseContext's active editingContext: [EMAIL PROTECTED]: Failed to save enrolments! at com.webobjects.woextensions.WOLongResponsePage.pageForException (WOLongResponsePage.java:205) at com.webobjects.woextensions.WOLongResponsePage.refresh (WOLongResponsePage.java:244) at com.webobjects.woextensions.WOLongResponsePage.invokeAction (WOLongResponsePage.java:224) at com.webobjects.appserver.WOSession.invokeAction (WOSession.java:1166) at com.webobjects.appserver.WOApplication.invokeAction (WOApplication.java:1375) at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWit hPreparedPage(WOComponentRequestHandler.java:196) at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWit hPreparedSession(WOComponentRequestHandler.java:287) at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWit hPreparedApplication(WOComponentRequestHandler.java:322) at com.webobjects.appserver._private.WOComponentRequestHandler._handleReque st(WOComponentRequestHandler.java:358) at com.webobjects.appserver._private.WOComponentRequestHandler.handleReques t(WOComponentRequestHandler.java:432) at com.webobjects.appserver.WOApplication.dispatchRequest (WOApplication.java:1306) at com.ish.webobjects.appserver.ISHApplication.dispatchRequest (ISHApplication.java:807) at com.ish.willow.college.appserver.Application.dispatchRequest (Application.java:172) at com.webobjects.appserver._private.WOWorkerThread.runOnce (WOWorkerThread.java:173) at com.webobjects.appserver._private.WOWorkerThread.run (WOWorkerThread.java:254)
        at java.lang.Thread.run(Thread.java:534)


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to