• 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
Re: refresh an enterprise object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >refresh an enterprise object (From: Goh Keng Boon <email@hidden>)
 >Re: refresh an enterprise object (From: Nathan Dumar <email@hidden>)
 >Re: refresh an enterprise object (From: Nathan Dumar <email@hidden>)
 >Re: refresh an enterprise object (From: Art Isbell <email@hidden>)

  • Prev by Date: UTF-8 Encoding questions for formValues() for non WO html fields
  • Next by Date: initiate content of NSArray
  • Previous by thread: Re: refresh an enterprise object
  • Next by thread: Re: refresh an enterprise object
  • Index(es):
    • Date
    • Thread