• 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: Question about fetching
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about fetching


  • Subject: Re: Question about fetching
  • From: Andrew Lindesay <email@hidden>
  • Date: Tue, 21 Jul 2009 20:20:26 +1200

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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Question about fetching (From: Francesco Romano <email@hidden>)

  • Prev by Date: Question about fetching
  • Next by Date: Re: Question about fetching
  • Previous by thread: Question about fetching
  • Next by thread: Re: Question about fetching
  • Index(es):
    • Date
    • Thread