• 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: can not save to defaultEditingContext
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: can not save to defaultEditingContext


  • Subject: Re: can not save to defaultEditingContext
  • From: "Jonathan Fleming" <email@hidden>
  • Date: Fri, 07 Feb 2003 22:13:10 +0000

From: Art Isbell <email@hidden>
To: email@hidden
Subject: Re: can not save to defaultEditingContext
Date: Fri, 7 Feb 2003 08:53:00 -1000

On Friday, February 7, 2003, at 08:08  AM, Jonathan Fleming wrote:

Reason: Cannot obtain globalId for an object which is not registered in any editingContext, object: {

this = "<TbClient 36a43c [Gid Not Found]>"; }, databaseContext: com.webobjects.eoaccess.EODatabaseContext@439a20, object's editingContext: null, databaseContext's active editingContext: com.webobjects.eocontrol.EOEditingContext@1e29fb

Note that this TbClient's editing context is null, so it hasn't been inserted into an editing context when this output was produced.


this is what I get when I view tbClient in a WOString just before submiting:

{

this = "<TbClient 56f122 <EOTemporaryGlobalID: 0 0 -64 -88 0 5 0 0 11 -77 1 0 0 0 0 -13 56 113 104 -1 -10 -55 -6 78>>"; }

This TbClient is in an editing context because it has a global ID, but note that this TbClient is not the same one as the first one. Their addresses differ: 36a43c vs. 56f122. This doesn't seem right.


           // create new tbClient object
           TbClient newTbClient = new TbClient();

// insert new tbClient into editing context ec.insertObject(newTbClient);

It's not this Art, I've tested it and i still get the same problem: Cannot obtain globalId for an object which is not registered in any editingContext


This is where I'm doing my saves if it helps:
public WOComponent dbAddTbClientToList() {
       try {
           tbClient.validateForSave();

           // save changes made in editing context to object store
           ec.saveChanges();

setNewTbClientAccountButtons ("showRevert_Preview_SaveNewAccountToList_CreateNew_Buttons");
setEditButtons (null);
setShowForm (null /*will show add new account button*/);
}
catch (NSValidation.ValidationException exception) {
validationDictionary.setObjectForKey(Boolean.TRUE,
"saveValidationFailed");
validationDictionary.setObjectForKey(exception.getMessage(),
"saveValidationString");
}


       return context().page();
   }



A new EO should be inserted in an editing context before setting any of its attributes because the editing context must observe these changes in order to produce correct SQL.


newTbClient.setLastName("Required");
newTbClient.setArtisteName("Not_Required_If_Artiste_Is_Filled_In");
newTbClient.setCompanyName("Not_Required_If_Artiste_Is_Filled_In");
newTbClient.setAddressLine1("Required");
newTbClient.setCityTown("Required");
newTbClient.setPostCode("Required");
newTbClient.setEmail1("Required");
newTbClient.setMetaDescription("Required");


           // create new tbClientData object
           TbClientData newTbClientData = new TbClientData();

// insert new tbClientData into editing context
ec.insertObject(newTbClientData);
// add new tbClient to tbClients relationship and set the tbAdminUser for it
tbAdminUser.addObjectToBothSidesOfRelationshipWithKey(newTbClient, "tbClients");
// add new tbClientData to tbClient relationship and set the tbClient for it
tbClient.addObjectToBothSidesOfRelationshipWithKey(newTbClientData, "tbClientData");
setReadyNewClient("Enter The New Client's Details");
// set the tbClient to newTbClient so the item can be entered in the list
tbClientData = newTbClientData;
tbClient = newTbClient;
NSLog.out.appendln("This is what's in the defaultEditingContext() " + ec);

Art
http://homepage.mac.com/aisbell/
_______________________________________________
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.


_________________________________________________________________
Worried what your kids see online? Protect them better with MSN 8 http://join.msn.com/?page=features/parental&pgmarket=en-gb&XAPID=186&DI=1059
_______________________________________________
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.

  • Prev by Date: Re: Error with intermediate many to many table
  • Next by Date: Re: Error with intermediate many to many table
  • Previous by thread: Re: can not save to defaultEditingContext
  • Next by thread: Re: WEIRD bug thing; 'shared' as reserved word? can you explain it?
  • Index(es):
    • Date
    • Thread