Re: Getting an abstract ID key - how?
Re: Getting an abstract ID key - how?
- Subject: Re: Getting an abstract ID key - how?
- From: "Jonathan Fleming" <email@hidden>
- Date: Sat, 01 Feb 2003 19:24:53 +0000
well Chuck,
I want to use it as a reference for an EOQualifier so I can get the user's
object(s) with a fetchspec when they are logged in. I have a WORepetition
bound to an NSMutableArray so that I can use in memory sort ordering by
lastName, companyName etc., but if I bind the WORepetition to the
relationship in the EOModel I gain what I am trying to do with the ID but
loose the ability to use in memory sort ordering even though the
relationship is also a NSMuttableArray.
So, I have found that if I instantiate (think I've used the right term here)
a variable with the users ID number I get what I want completly, all the
objects/database rows for that user.
As you can see in the code below which sits in the constructor of the
Session Class the fetchspec works when the local var is given an ID number
manually but obviously I need to do this progmatically as soon as the user
is logged in to their session.
/*
* variable use to preset bindings array else
* java.lang.IllegalStateException exception will be caused
* this local var is here for test purposes only!!!
*/
String adminUserID = "3";
System.out.println(this.getClass().getName() + "s awake method
called");
// build fetch specification
NSArray bindings = new NSArray(
new Object [] {
new Integer( adminUserID ) } );
EOQualifier qualifier =
EOQualifier.qualifierWithQualifierFormat("adminUserID = %@",
bindings );
fetchSpec = new EOFetchSpecification("TbClient", qualifier, null);
// fetch
fetchTbClientList();
}
I imagine i'm going t get a scolding now... oh well, at least I'll learn.
Regards
Jonathan
Ps The Pragmatic Programmer book is being delivered on Monday 3rd Feb,
looking forward to cleaning up my coding act.
From: Chuck Hill <email@hidden>
To: "Jonathan Fleming" <email@hidden>,
email@hidden
Subject: Re: Getting an abstract ID key - how?
Date: Sat, 01 Feb 2003 09:58:37 -0800
Why do you want to use the PK as a ref number? For what purpose?
If you really are going to use the PK for some use other than as a PK, why
do you object to being honest ;-) about it and stating so in the EOModel?
Yes, you can rape it out, but why?
Chuck
At 05:34 PM 01/02/2003 +0000, Jonathan Fleming wrote:
>I have created a user object in a secure login area and I want to obtain
the
>primary key of that object as a ref number, but the ID in the entity is
set
>as abstract so I can not access it from the EOCustomObject (java file)
>created by the EOModel. How do I get to present the primary key in an
iVar
>without turning the diamond on in the EOModel to get the primary key
>displayed in an instance variable?
>
>The table/entity is AdminUser = adminUser
>the ID is adminUserID
>when I enclose the object in a WOString component I can see:
>{values = {accessLevel = "Moderator"; lastName = "Fleming"; clients =
>"<com.webobjects.eocontrol._EOCheapCopyMutableArray 6df389
>(<EOAccessArrayFaultHandler clients _EOIntegralKeyGlobalID[AdminUser
>(java.lang.Integer)3]>)>"; }; this = "<AdminUser 2f72d8
>_EOIntegralKeyGlobalID[AdminUser (java.lang.Integer)3]>"; }
>
>but I don't know how to get the adminUserID (3) or the
>_EOIntegralKeyGlobalID[AdminUser (java.lang.Integer)3] out so I can
access
>an use it for reference
>
>Can you help?
>
>Simple enough question, but with WebObjects it an proove very difficult
>especially when you don't know how and I don't know how.
>
>Kind regards
>Jonathan
>
>_________________________________________________________________
>Use MSN Messenger to send music and pics to your friends
>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.
>
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
_______________________________________________
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.
_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today!
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.