Re: EO not getting marked as needing to be updated
Re: EO not getting marked as needing to be updated
- Subject: Re: EO not getting marked as needing to be updated
- From: Greg Hulands <email@hidden>
- Date: Thu, 17 Jun 2004 16:25:02 +1000
There are no validation methods in either EO. All commandments are
followed my lord!
It's a strange one
On 17/06/2004, at 3:55 PM, Chuck Hill wrote:
Modifying any objects in the validate... methods? Violating any of
the other EOF commandments at www.wodev.com?
Chuck
On Jun 16, 2004, at 10:31 PM, Greg Hulands wrote:
Hi,
I have an EO that does not seem to be getting updated in the database.
GiftCertificate cert = null;
try {
cert =
(GiftCertificate)EOUtilities.objectMatchingKeyAndValue(session().defau
lt
EditingContext(), "GiftCertificate", "unlockCode", code);
if (cert != null) {
if (cert.dateRedeemed() != null) {
error = "This Gift Certificate has already been redeemed.";
} else {
cert.setDateRedeemed(new NSTimestamp());
error = "Gift Certificate Redeemed.";
ClientGiftCertificate record = new ClientGiftCertificate();
session().defaultEditingContext().insertObject(record);
record.setBalance(cert.amount());
((Session)session()).user().addObjectToBothSidesOfRelationshipWithKey(
re
cord, "giftCertificates");
record.addObjectToBothSidesOfRelationshipWithKey(cert,
"giftCertificate");
session().defaultEditingContext().saveChanges();
}
} else {
error = "Invalid Gift Certificate Code.";
}
}
The cert object is the one that doesn't get updated. I have logged the
editing context's updatedObjects and it lists nothing after I set the
date redeemed. The record object gets inserted into the database OK,
so
there seems to be a problem just with the cert object. I tried
setting
the date redeemed twice to see if that had an effect, but it too did
not fix it. I also changed the way I fetched the cert by creating a
qualifier and fetch spec and using the editing context to fetch it -
basically what the eoutil method does. This too didn't fix the
problem.
This is really starting to bug me as you can probably tell from the
code, if it does not update the redemption date, you can keep
redeeming
the same code, and that is no good for business! :-(
Any help is very much greatly appreciated.
Regards,
Greg
_______________________________________________
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.
_______________________________________________
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.