I would suspect that you aren't marking the E_Person dirty in the editing context. Assuming you are using an EOCustomObject your setFName method should look something like this...

public void setFName(String value)
{
        willChange(); // <- this is the important line
        fname = value;
}

As an aside, you also don't need to pre-initialize your variables there... Ie:

E_Person person=new E_Person()
NSArray searchResult=new NSArray();

Since both of those are set to other things without using what you initialized it to originally...

On Feb 9, 2006, at 2:44 AM, .::welemski::. wrote:

Hi,

Is is ok to call "defaultEditingContext" everytime I make a changes in the database?

Because I can no longer make any changes in the database/table everytime I call "saveChanges" method.

I have this code;
Assuming that there is a String varialble name "Fname" and "Lname" in the session.

E_Person person=new E_Person()
EOEditingContex ec=session().defaultEditingContext();
Session session=(Session)session();
NSMutableDictionary criteria=new NSMutableDictionary();
criteria.setObjectForKey(session.Fname,"FName");
criteria.setObjectForKey(session.Lname,"LName");
NSArray searchResult=new NSArray();
searchResult=EOUtilities.objectsMatchingValues (ec,"E_Person",criteria);

if(searchResult.count()>=1){
   person=(E_Person)searchResult.objectAtIndex(0);
   person.setFName("New Name");
   person.setLName("New Surname");
   ec.saveChanges();
}

the code above will not produce an error but it wont make any changes in the Entity either...


--
 -- -- -- -- -- -- -- -- -- -- --
          welemski
 -- -- -- -- -- -- --
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/rklems% 40apple.com

This email sent to [EMAIL PROTECTED]

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
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