Large to-many relationships and caching "Best Practise"
Large to-many relationships and caching "Best Practise"
- Subject: Large to-many relationships and caching "Best Practise"
- From: Michael Halliday <email@hidden>
- Date: Tue, 11 Aug 2009 11:32:20 -0400
Hi List,
Let's say you have in your model:
Customer -->> Transactions
Since a customer could have 1000's or 10000's transactions ... obviously you wouldn't want to have transactions as a class property on the Customer EO for performance reasons. Normally you would never want to get at ALL the transactions for a customer at once, but you might want to get "Open" transactions or "Flagged" transactions. So, for example you could have a method on the Customer EO that just fetches the Transaction with a qualifier as below:
public NSArray<Transaction> openTransactions() { return Transaction.fetchTransactions(editingContext(), Transaction.CUSTOMER.eq(this).and(Transaction.STATUS.eq("Open")), null); }
Now, this is all well and good ... but what's the "best practice" for caching this result? You wouldn't want to bind this method up to a WORepetition for example! I'd just be curious to see how other people are handling these situations. Do you cache this stuff in the EO itself ... or do you just limit calls to such methods and cache the return value? I'm basically describing the role of Core Data's fetched properties.
Cheers, Michael
|
_______________________________________________
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