Hello Francesco;

You can construct an EOGlobalID from the primary key an fault it. I would generally not advocate using the primary key in this manner as it may be volatile owing to migration of schema or database product migration. That concern aside, assuming you have a primary key and it has an attribute name of "id";

        Number pk = ???
        EOEditingContext ec = ???
        EOEntity entity = EOModelGroup.defaultGroup().entityNamed("FooBar");
        EOGlobalID gid = entity.globalIDForRow(new NSDictionary(pk,"id"));
        FooBar = (FooBar) ec.faultForGlobalID(gid);

Hope this helps.

cheers.

This is a simple (and maybe stupid) question.
I'm doing an application (an e-commerce application.. maybe wo is not the best choice, but I know java better than ruby..), and I've some pages accessed with directaction. Maybe I'm wrong, but I can pass values to a page only with the url, so.. only strings.
In a page I select an EntityObject and I've to pass to the other page.
If I can't pass the whole object, I would like to pass the primary key, so fetching should be faster..
But.. I can get the key, but I can't fetch an Object with it's PK.
Now i pass a name (a description string..).. but it's not unique, so even with low probability, there can be collisions..

___
Andrew Lindesay
www.lindesay.co.nz

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to