• 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 18:08:24 +0000

This is the method that returns the tbClient to be added to the tbAdminUser relationship.

public WOComponent addClientToAdminUser() {
if (tb_AdminUserID.equals("testMethod")) {
CreditCardPayment nextPage = (CreditCardPayment)pageWithName("CreditCardPayment");
return nextPage;
}
else {
// get editing context
EOEditingContext ec = session().defaultEditingContext();


// create new tbClient object
TbClient newTbClient = new TbClient();
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 tbClient into editing context
ec.insertObject(newTbClient);
// 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);


           return null;
       }
   }






From: Michael Kondratov <email@hidden>
To: "Jonathan Fleming" <email@hidden>
Subject: Re: can not save to defaultEditingContext
Date: Fri, 7 Feb 2003 12:44:43 -0500

Ok..
A sample code

SomeObject someObject = new SomeObject(); // Creating a new EO objects
this.session().defaultEditingContext().insertObject(someObject); // Insert EOinto editing context


someObject.takeValueForKey(value,"key"); // make modifications to new objects
this.session().defaultEditingContext().saveChnages(); // save object


Michael
www.aspireauctions.com


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

Before the problem, here's the relationship of the entity's: tbAdminUser has a toMany relationship with >> < tbClient which has a toOne relationship with tbAdminUser. tbClient goes on to have a oneToOne relationship with tbClientData and oneToOne back
After logging in as the registered user I make an attempt to create a new tbClient (account/object/row) and the form loads with the required setting, but when I submit to save I get this Error


Error: java.lang.IllegalStateException
Reason: Cannot obtain globalId for an object which is not registered in any editingContext, object: {values = {modificationDate = <com.webobjects.foundation.NSKeyValueCoding$Null>; clientRefNo = <com.webobjects.foundation.NSKeyValueCoding$Null>; tbClientData = "<TbClientData 61dfb5 <EOTemporaryGlobalID: 0 0 -64 -88 0 5 0 0 11 -77 3 0 0 0 0 -13 56 113 104 -1 -10 -55 -6 78>>"; regRenewalReminderDate = <com.webobjects.foundation.NSKeyValueCoding$Null>; companyName = <com.webobjects.foundation.NSKeyValueCoding$Null>; addressLine1 = <com.webobjects.foundation.NSKeyValueCoding$Null>; addressLine2 = <com.webobjects.foundation.NSKeyValueCoding$Null>; tbCatJoin_tbCategorys = "null"; artisteName = <com.webobjects.foundation.NSKeyValueCoding$Null>; lastName = <com.webobjects.foundation.NSKeyValueCoding$Null>; }; 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


Stack trace: File Line# Method Package
* these are the hyperlinked messages of the Stack trace
----------------------------------------------------------------------- ---------
EODatabaseContext.java 4677 _globalIDForObject com.webobjects.eoaccess
EODatabaseContext.java 4780 databaseOperationForObject com.webobjects.eoaccess
EODatabaseContext.java 6041 recordUpdateForObject com.webobjects.eoaccess
EODatabaseContext.java 4907 relayAttributesInRelationshipSourceObjectDestinationObject com.webobjects.eoaccess
EODatabaseContext.java 6005 recordChangesInEditingContext com.webobjects.eoaccess
EOObjectStoreCoordinator.java 393 saveChangesInEditingContext com.webobjects.eocontrol
EOEditingContext.java 2498 saveChanges com.webobjects.eocontrol
*
Tab3UpdateDirectory.java 616 dbAddTbClientToList Tab3UpdateDirectory
KeyValueCodingProtectedAccessor.java 24 methodValue KeyValueCodingProtectedAccessor
Application.java 374 dispatchRequest Application


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

{values = {countOfCategories = <com.webobjects.foundation.NSKeyValueCoding$Null>; clientRefNo = <com.webobjects.foundation.NSKeyValueCoding$Null>; tbClientData = "<TbClientData 2ed5f9 <EOTemporaryGlobalID: 0 0 -64 -88 0 5 0 0 11 -77 2 0 0 0 0 -13 56 113 104 -1 -10 -55 -6 78>>"; regRenewalReminderDate = <com.webobjects.foundation.NSKeyValueCoding$Null>; companyName = "Not_Required_If_Artiste_Is_Filled_In"; addressLine1 = "22 Testing Field Road"; addressLine2 = <com.webobjects.foundation.NSKeyValueCoding$Null>; creationDate = 2003-02-07 13:20:09 Etc/GMT; cellular = <com.webobjects.foundation.NSKeyValueCoding$Null>; tbAdminUser = "<TbAdminUser 2452e8 _EOIntegralKeyGlobalID[TbAdminUser (java.lang.Integer)1]>"; tbCatJoin_tbCategorys = (); artisteName = "Not_Required_If_Artiste_Is_Filled_In"; lastName = "Required"; }; 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>>"; }

I believe i am already in the the session().defaultEditingContext() and this what is in it having used NSLog:

This is what's in the defaultEditingContext() com.webobjects.eocontrol.EOEditingContext@1e29fb
Setting Category(s) to {values = {categoryName = "Accustics"; tbCatJoin_tbClients = "<com.webobjects.eocontrol._EOCheapCopyMutableArray 27508a (<EOAccessArrayFaultHandler tbCatJoin_tbClients _EOIntegralKeyGlobalID[TbCategory (java.lang.Integer)5]>)>"; }; this = "<TbCategory 7fc686 _EOIntegralKeyGlobalID[TbCategory (java.lang.Integer)5]>"; }


What am I obviously not getting right here? Can anyone help correct my problem?

Jonathan
Ps. I striped out some of the field information because of the post size restriction, but I'm sure i've left the relvent details.


_________________________________________________________________
Chat online in real time with MSN Messenger http://messenger.msn.co.uk
_______________________________________________
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.

  • Follow-Ups:
    • Re: can not save to defaultEditingContext
      • From: Art Isbell <email@hidden>
  • Prev by Date: Re: WEIRD bug thing; 'shared' as reserved word? can you explain it?
  • Next by Date: Re: can not save to defaultEditingContext
  • Previous by thread: can not save to defaultEditingContext
  • Next by thread: Re: can not save to defaultEditingContext
  • Index(es):
    • Date
    • Thread