Re: refresh an enterprise object
Re: refresh an enterprise object
- Subject: Re: refresh an enterprise object
- From: Goh Keng Boon <email@hidden>
- Date: Tue, 22 Jun 2004 16:44:43 +0800
You should instead match on a unique key that's not the primary key if
at all possible.
If i catch you correctly, i should have statusid , statuscode ,
statusdescription in my "statustable" in order to avoid reference to PK
and statuscode is unique.
Thanks, i found out that also, but for current application, no one can
modify "statustable", as a result the meaning wont change at all. So i
would follow your last
suggestion, use that instead.
thanks alot :-)
On 22-Jun-04, at 4:17 PM, Art Isbell wrote:
On Jun 21, 2004, at 8:36 PM, Goh Keng Boon wrote:
I managed to do it by :
EOEnterpriseObject aStatus =
EOUtilities.objectMatchingKeyAndValue(ec,"transfernotestatus","transfe
rnotestatusid",new Double(3));
aTransferNote.addObjectToBothSidesOfRelationshipWithKey(transferStatus
,"_rtransfernotestatus");
In this case i'm able to set the relationship and specify the exact
statusid(in this case is 3) that i want it to be stored inside my
aTransferNote object.
Is this the correct way of doing things in WO??
Not normally. You should almost never need to reference primary and
foreign keys in your Java code, so they should not be class properties
in your eomodel. You should instead match on a unique key that's not
the primary key if at all possible.
One reason for this is to eliminate references to meaningless values
in your Java code. I.e., what TransferNoteStatus is "3"? Doesn't
each TransferNoteStatus object have some sort of meaningful and unique
description string? If so, use that instead.
Aloha,
Art
_______________________________________________
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.