• 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: Need To Get PrimaryKey ID
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need To Get PrimaryKey ID


  • Subject: Re: Need To Get PrimaryKey ID
  • From: "Jonathan Fleming" <email@hidden>
  • Date: Sat, 22 Mar 2003 13:29:54 +0000

First of all I would like to say a big thank you to all those who replied to this post (George, Robert, Jacky, Art, Pete are the replies I have so far). I have not applied your suggestions yet, but they seem as if they are on the ball and I'll be using the best option soon after this reply.

Art, your reply is in the body of text.



From: Art Isbell <email@hidden>
To: email@hidden
Subject: Re: Need To Get  PrimaryKey  ID
Date: Fri, 21 Mar 2003 11:01:01 -1000

On Friday, March 21, 2003, at 09:44  AM, Jonathan Fleming wrote:

Below is the Method i am trying to use and I'm getting null value in the WOString element that i'm testing it with in the build for every item in my fetched List...

When you single-step through your method in the Java debugger, > at what point are you seeing an unexpected null value?

believe it or not, I've never used the debuger in project builder because I don't know how to use it correctly. I debug by building the app and using the NSLog.out.appendIn statement. If there is some documentation on how to use the project builder debugger could you point me to it please.



   protected TbJob tbJob;
   protected TbJobPicture tbJobPicture;
   protected String sTb_JobID;
   protected String sTb_ClientID;

public Integer tbClientID() {
EOEnterpriseObject tbJobPicture = (EOEnterpriseObject) valueForKeyPath("tbJob");
NSDictionary primaryKey = EOUtilities.primaryKeyForObject(tbJobPicture.editingContext(), tbJob);

Looks like you're using tbJobPicture only to get its editing context. If tbJob isn't in the same editing context, its primary key probably won't be returned. Why not just use its editing context - tbJob.editingContext()?

I didn't think of that... I thought I was traversing the relationship to the tbJobID from tbJobPicture ec. I didn't realise that by setting the ec to tbJobPicture.editingContext(), that it would only get the objects of that ec.
So I've still got a bit to understand about ec's it seems.



       NSLog.out.appendln("Dictionary to get tbClientID: " + primaryKey);
       String strID = new String();

No need to create a new string.

OK, I'll delete this


strID = String.valueOf( (Integer) primaryKey.valueForKey("tbClientID") );
setTb_ClientID(strID);


return (Integer) primaryKey.valueForKey("tbClientID");

If the JVM optimizer doesn't notice that you are asking the primaryKey dictionary for the value of its tbClientID key twice, your app will be spending more execution time than necessary. For the best-performing app, it's probably best not to depend on automatic optimization to provide the best performance. Instead, it's probably best to cache the value of primaryKey's tbClientID key in a local variable and reference that variable twice. Little things like this could add up to degrade performance.

Understood


   }


public String getTb_ClientID() { return sTb_ClientID; }

public void setTb_ClientID(String value) {
NSLog.out.appendln( "\nThe Client ID For " + sClientLastName() + " is: " + getTb_ClientID() );

You probably realize that the above statement will return the sTb_ClientID value prior to the new value being set, so this will print a null value before sTb_ClientID is set.


       sTb_ClientID = value;
   }

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.


_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger http://messenger.msn.co.uk
_______________________________________________
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.

  • Prev by Date: multiple web services consumers
  • Next by Date: Cocoa EOF Applications & December 2002 Dev Tools
  • Previous by thread: multiple web services consumers
  • Next by thread: Cocoa EOF Applications & December 2002 Dev Tools
  • Index(es):
    • Date
    • Thread