• 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
saveChanges() not saving
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

saveChanges() not saving


  • Subject: saveChanges() not saving
  • From: "David Haggerty" <email@hidden>
  • Date: Thu, 1 Mar 2007 12:40:55 -0500
  • Thread-topic: saveChanges() not saving

I have come across a rather strange problem.  Changes to an EO are not saving properly.  In memory it shows that I have changed the EO but when I look at the editingContext, it doesn't show it in _unprocessedChanges.  It also doesn't save the change that I am making.  I finally realized that if I call ec.committedSnapshotForObject(ecr);  BEFORE I make any changes to the object, it works fine. 
 
Here's an example of the code:
 
EOEditingContext ec = new EOEditingContext();
//   If I uncomment this, it saves properly.
//   ec.committedSnapshotForObject(ecr);
EmailCommunicationRecipient ecr = (EmailCommunicationRecipient)EOUtilities.faultWithPrimaryKeyValue(ec, "EmailCommunicationRecipient", new Integer(11312312));
ecr.setDateSent(new NSTimestamp());
ec.saveChanges();
 
Strangely, if I do the following, the dateSent won't save but the status will:
 
EOEditingContext ec = new EOEditingContext();
EmailCommunicationRecipient ecr = (EmailCommunicationRecipient)EOUtilities.faultWithPrimaryKeyValue(ec, "EmailCommunicationRecipient", new Integer(11312312));
ecr.setDateSent(new NSTimestamp());
ec.committedSnapshotForObject(ecr);
addObjectToBothSidesOfRelationshipWithKey(aValue, "toCurrentStatus");
ec.saveChanges();
 
The only thing special with EMailCommunicationRecipient is that it is a single table inhertance in the model.
 
EMailCommunicationRecipient extends CommunicationRecipient which extends AbstractCommunicationRecipient.
 
Until I figure out what's going on, I was going to just add the following (because I just don't know how many places this is happening).  Will this add much overhead?:
 
public void awakeFromFetch(EOEditingContext ec){
    super.awakeFromFetch(ec);
    ec.committedSnapshotForObject(ecr);
}
 
Thanks,
David
 _______________________________________________
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: saveChanges() not saving
      • From: Chuck Hill <email@hidden>
  • Prev by Date: Re: Converting Apps From Xcode > Eclipse [Problems Solved]
  • Next by Date: Re: Converting Apps From Xcode > Eclipse [Problems Solved]
  • Previous by thread: Re: Flash and WebObjects
  • Next by thread: Re: saveChanges() not saving
  • Index(es):
    • Date
    • Thread