• 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: Fetching Unqualified Data Vs Qaulified Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fetching Unqualified Data Vs Qaulified Data


  • Subject: Re: Fetching Unqualified Data Vs Qaulified Data
  • From: Arturo PĂ©rez <email@hidden>
  • Date: Thu, 9 Jan 2003 07:47:14 -0500

On Wednesday, January 8, 2003, at 01:15  PM, Jonathan Fleming wrote:

In my EOModel I have two entities, TbAdmin & TbClientAccount
TbAdmin has a toMany relationship with TbClientAccount
TbClientAccount has a toOne relationship with TbAdmin
When the user(TbAdmin) enters their administration page in the application, they can see every row of the TbClientAccount entity rather than just their own rows/records. I have used an unqualified fetch and in-memory sort orderings, but here's my point; I thought that by having a oneToMany relationship from TbAdmin to TbClientAccount an unqualified fetch would automatically fetch only the rows belonging to that logged in user.

Are you using DisplayGroups? A master-detail display group would do this the way you expect.
If you're not using a DG then are you traversing the relationship from TbAdmin to TbClientAcccount? Or
are you really doing a fetch as you say? For example, let's say you have a logged in TbAdmin in session.
Then, in your TbClientAccount display page you bind a repetition to session->TbAdmin->toTbClientAccounts
and everything would work as you detail above.


Rereading your message: No, having the relationships have no effect on unqualified fetches. But, again,
you don't need fetches in the above situation. If you have an EOCustomObject then all you need to do
is access the TbAdmin->toTbClientAccounts array. If you don't have a custom object then you need to
TbAdmin.valueForKey("toTbClientAccounts")



Since I seemingly have this wrong, I think I have to create a qualified fetch on the adminID of the TbAdmin entity, but I do not know how to get the ID from the entity as it is abstract. Can anyone forward a method or methods that will enable me to provide an instance variable with the user's ID that I can create a fetch with.

You really shouldn't need fetch specs in this situation.

I have seen several methods refering to primaryKey in the Java Library (api) but I am still uncertain as to which one should be used.
Or have I simply build the model wrong?



I think you're just building the page wrong.

There's a thing called DbEdit. It's kind of a sqlplus that uses the EOModel to write the queries. So you
can, essentially, select TbAdmin where userid = 'frodo', and then walk the relationships to verify your EOModel.
It's at http://www.rubicode.com/Software/DBEdit/. You could try that to make sure the models OK.
_______________________________________________
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: 
 >Fetching Unqualified Data Vs Qaulified Data (From: "Jonathan Fleming" <email@hidden>)

  • Prev by Date: Re: Fetching Unqualified Data Vs Qaulified Data
  • Next by Date: Project Builder Assistant
  • Previous by thread: Re: Fetching Unqualified Data Vs Qaulified Data
  • Next by thread: How do I know when an EOEnterpriseObject is removed from an Editi ng Context?
  • Index(es):
    • Date
    • Thread