Re: Memory Management (or rather documenting thereof...)
Re: Memory Management (or rather documenting thereof...)
- Subject: Re: Memory Management (or rather documenting thereof...)
- From: Chuck Hill <email@hidden>
- Date: Mon, 2 Mar 2009 12:24:21 -0800
On Mar 2, 2009, at 9:03 AM, Ray Kiddy wrote:
Is there a reason we do not seem to be talking about or updating the
wiki documentation anymore?
Yes:
- loss of Will to Live
- realization that only .01% of people will actually look at the wiki
before posting
- realization that only .005% of people are aware of Google and what
it can be used for
:-P
Looking at this post, I realized there could be a discussion of
this on the doc (at http://wiki.objectstyle.org/confluence/display/WO/Programming__WebObjects-EOF-Modeling-Fetch+Specifications)
and there is none.
Just recently, I answered a question about value types without
recalling, or mentioning, that this is documented there also (at http://wiki.objectstyle.org/confluence/display/WO/EOF-Modeling-Common+Pitfalls+and+Troubleshooting)
, although that page name might not make it extremely easy to find.
I am certainly going to poke myself and remember to start putting
things up on the documentation. Just saying, it is great to respond
to the mailing list, but documentation could reduce the need for
people to post so many questions to the list....
Good point. If I can find my Will to Live, I will resume updating it.
Chuck
cheers - ray
On Mar 1, 2009, at 8:04 PM, Andrew Lindesay wrote:
Hello Jeff;
Fair enough. I will keep it simple...
First, create a fetch specification for the main EO that you wish
to operate on and prep it for pulling out the primary key;
EOEntity fooE = EOModelGroup.globalModelGroup().entityNamed("Foo");
EOFetchSpecification fs = ...
fs.setFetchesRawRows(true);
fs.setRawRowKeyPaths(fooE.primaryKeyAttributeNames());
By doing this, you don't give EOF so much work to do ensuring the
EO's you are working with are unique. OK so now fetch this into an
NSArray...
NSArray rrs = null;
{
EOEditingContext ec = new EOEditingContext();
ec.lock();
try { rrs = ec.objectsWithFetchSpecification(); }
finally { ec.unlock(); }
}
...work through these raw rows 50 (as an example) at a time...
for(int i=0;i<rrs.count();i+=50)
{
NSMutableArray<EOQualifier> qs = new NSMutableArray<EOQualifier>();
for(int j=i;(j<(i+50)) && (j<rrs.count());j++)
{
EOGlobalID gid = fooE.globalIDForRow((NSDictionary)
rrs.objectAtIndex(j));
qs.addObject(LEEOHelper.qualifierForGlobalID(gid)); <--- copy
this method from LEWOStuff source.
}
EOEditingContext ec = new EOEditingContext();
ec.lock();
try
{
EOFetchSpecification fs = new EOFetchSpecification("Foo",new
EOOrQualifier(qs),null);
...fetch those EO's and do some stuff with them...
}
finally { ec.unlock(); }
}
...hope this helps and post back to the list (CC me) if you are
confused.
cheers.
Yes, I saw your post. However, I'm not an advanced EOF user, nor
do I know SQL very well (it's one of the reason I like
webobjects). That and the fact that any change I make needs to be
working in a couple of weeks makes me want to save a change like
you suggest for later when I've got more time to come up to speed
and to test. Maybe it's not as hard as it sounds? Keep in mind
that right now when you say "Load the list of EO's into memory to
be processed as raw-rows with the PK in the raw rows." I have NO
idea what you're talking about.
___
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
_______________________________________________
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
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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