• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Shared editing context: rules of engagement
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shared editing context: rules of engagement


  • Subject: Re: Shared editing context: rules of engagement
  • From: Fabian Peters <email@hidden>
  • Date: Thu, 19 Apr 2007 09:57:48 +0200

Hi Lachlan,

Am 19.04.2007 um 08:42 schrieb Lachlan Deck:

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..."

Ok, so the object you're trying to establish a relation with does not seem to be in the shared EC (SEC).


Okay, my understanding is that you ought _not_ have relationships going from a shared entity to a non-shared entity.

Yes.

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.

Mmhhh, are your sure this is working correctly? I've never done anything like this and would think that it's rather tricky to get such a setup to work?


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.

You mean you fetch some non-shared EO into a standard EC, set up a relation with a shared EO and save? Yes.


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 );

Why are you setting the SEC to null here? If in this EC you're trying to set up a relationship to a shared EC, this is going to fail. Or is this the EC you're going to use to remove relationships to non-shared EOs from EOs that are to be shared?


		_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 );
}

If it's not the setting to null of the SEC above, then I'd say your "code that removes any such relations from the entities as they are registered" seems suspicious. Could we get more details on that?


cheers

Fabian

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: com.webobjects.eoaccess.EODatabaseContext@c743eb, object's editingContext: com.webobjects.eocontrol.EOSharedEditingContext@ba5c7a, databaseContext's active editingContext: com.ish.willow.eocontrol.WillowEditingContext@1a78071: 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._dispatchW ithPreparedPage(WOComponentRequestHandler.java:196)
at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchW ithPreparedSession(WOComponentRequestHandler.java:287)
at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchW ithPreparedApplication(WOComponentRequestHandler.java:322)
at com.webobjects.appserver._private.WOComponentRequestHandler._handleReq uest(WOComponentRequestHandler.java:358)
at com.webobjects.appserver._private.WOComponentRequestHandler.handleRequ est(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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
40e-lumo.com


This email sent to email@hidden

_______________________________________________ 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
  • Follow-Ups:
    • Re: Shared editing context: rules of engagement
      • From: Lachlan Deck <email@hidden>
References: 
 >Shared editing context: rules of engagement (From: Lachlan Deck <email@hidden>)

  • Prev by Date: Off-Topic - What GUI designer?
  • Next by Date: Fetch objects: Error in MYSQL or WO
  • Previous by thread: Shared editing context: rules of engagement
  • Next by thread: Re: Shared editing context: rules of engagement
  • Index(es):
    • Date
    • Thread