RE: EOF question
RE: EOF question
- Subject: RE: EOF question
- From: <email@hidden>
- Date: Fri, 9 Jul 2004 14:16:01 +0200
- Thread-topic: EOF question
Hi!
I guess this is a job for the BestMatchQualifier (http://homepage.mac.com/I_love_my/webobjects.html).
From the top of my head:
EOQualifier userQualifier = new EOKeyValueQualifier("user", EOQualifier.QualifierOperatorEqual, someUser); // optional
EOQualifier bmQualifier =
new BestMatchQualifier(
"date",
new NSTimestamp(),
EOQualifier.QualifierOperatorLessThanOrEqual,
userQualifier,
"user");
EOFetchSpecification fetchSpec = new EOFetchSpecification("Order", bmQualifier, null);
fetchSpec.setPrefetchingKeyPath(new NSArray("user"));
NSArray lastOrders = editingContext.objectsWithFetchSpecification(fetchSpec);
This will give you a array of orders. The linked users will have been prefetched: they are in memory as spearate objects. What you don't get is an object joining both fields from User and Order entities.
You could also fetch as raw rows. You can then get untyped dictionaries containing all the fields to your liking.
Pierre
-----Original Message-----
From: email@hidden
[mailto:email@hidden]On Behalf Of Sako!
Sent: Thursday, July 08, 2004 10:11 AM
To: lists apple com; omni group
Subject: EOF question
hi,
i plan a new DB like this:
table Users( UserID(PK) , tel, name, et...)
table Orders(UserID(FK) + OrderID)(PK), amount, date, cost, etc...
// i have one-to-Meny relationship
i want to get the (user infromation + the LAST order information ) in one
fetch with help from EOModeler.
example:
UserID, tel, name, LASTOrderID, LASTamount, LASTDate, et... all these in one
row.
can i do that? or my relationship between the tables is wrong?
regards.
_______________________________________________
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.
**********************************************************************
This email and any files transmitted with it are intended solely for
the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the sender
of this message. (email@hidden)
This email message has been checked for the presence of computer
viruses; however this protection does not ensure this message is
virus free.
Banque centrale du Luxembourg; Tel ++352-4774-1; http://www.bcl.lu
**********************************************************************
_______________________________________________
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.