Re: can not save to defaultEditingContext
Re: can not save to defaultEditingContext
- Subject: Re: can not save to defaultEditingContext
- From: Seejo Pylappan <email@hidden>
- Date: Fri, 7 Feb 2003 13:35:34 -0500
From: Seejo Pylappan <email@hidden>
Date: Fri Feb 7, 2003 1:27:36 PM US/Eastern
To: "Jonathan Fleming" <email@hidden>
Cc: email@hidden, email@hidden,
email@hidden
Subject: Re: can not save to defaultEditingContext
Insert it to the editingContext after you are done with the creation:
// get editing context
EOEditingContext ec = session().defaultEditingContext();
// create new tbClient object
TbClient newTbClient = new TbClient();
ec.insertObject(newTbClient);
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);
.
.
Also where are you doing the save changes?
-Seejo
On Friday, February 7, 2003, at 01:08 PM, Jonathan Fleming wrote:
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;
}
}
_______________________________________________
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.