Re: Fetching Unqualified Data Vs Qaulified Data
Re: Fetching Unqualified Data Vs Qaulified Data
- Subject: Re: Fetching Unqualified Data Vs Qaulified Data
- From: Art Isbell <email@hidden>
- Date: Wed, 8 Jan 2003 21:37:45 -1000
On Wednesday, January 8, 2003, at 08:15 AM, 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.
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.
The entity can't be abstract if you are going to fetch its objects
into your app.
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.
Avoid manipulating primary and foreign keys using EOF. Ideally, these
should be meaningless integers that EOF uses in the background.
Or have I simply build the model wrong?
Your model seems OK if a user is represented by a TbAdmin object.
What you need to do is fetch the TbAdmin object that represents the
current user and display the TbAdmin.tbClientAccounts relationship (or
whatever you named it). So you need to have gathered sufficient info
about the user to create a qualifier that can be used to fetch the
correct TbAdmin object. This is frequently done during a login process.
Art
http://homepage.mac.com/aisbell/
_______________________________________________
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.