Re: Best practice for exporting big data...
Re: Best practice for exporting big data...
- Subject: Re: Best practice for exporting big data...
- From: Eugene Khablov <email@hidden>
- Date: Tue, 05 Dec 2006 18:38:12 +0300
- Thread-topic: Best practice for exporting big data...
Hi!
For fetching data using in reports in our application we use separate
coordinator that even connects to MySQL replication server. This coordinator
caches in framework's principal class. All we need than is to create new
editing context with this coordinator as a parent.
All relevant code is attached.
Due to renaming custom prototype entity in Project Wonder this approach
requires creating one more prototype entity for initializing new osc's model
group. It works perfect but looks like a hack.
Can anyone see the drawbacks of this approach or better way of doing this?
Could cloning the prototype entity programmatically do the trick?
Hope this could be useful.
---
Eugene Khablov
Media Agency "Design Maximum"
On 12/5/06 3:51 PM, "Kieran Kelleher" <email@hidden> wrote:
> Hi James,
>
> Another thread may help, but for long EOF intensive tasks, a new
> ObjectStoreCoordinator (new db connection) can be better. I have some
> long processes that hammer the db generating report data for 10 to 15
> seconds and I find this approach works well to not block all users of
> the app. It also is much faster.
>
> // Create a new EOF stack (includes new connection to the db)
> EOObjectStoreCoordinator longTaskCoordinator = new
> EOObjectStoreCoordinator();
>
> // Use the separate EOF stack
> EOEditingContext ec = new EOEditingContext( longTaskCoordinator );
>
> NSArray objects = ec.objectsWithFetchSpec ..... etc.
>
> Cheers, Kieran
>
> On Dec 4, 2006, at 9:53 PM, James Cicenia wrote:
>
>> Hello -
>>
>> I have created a nice custom report generator based upon D2W and it
>> works
>> like a charm except for the occasional bad problem.
>>
>> If a person doesn't filter the selection and pulls all the data
>> with all the attributes
>> it can cause my server to basically deny others.
>>
>> Do I have to put this process in a different thread? Do I have to
>> use a long response
>> page?
>>
>> Thanks
>> James Cicenia
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> 40mac.com
>>
>> 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
>
>
private EOObjectStoreCoordinator readOnlyObjectStoreCoordinator;
private EOModelGroup readOnlyEOModelGroup;
private EOModelGroup readOnlyEOModelGroup() {
if (readOnlyEOModelGroup == null) {
ERXProperties.setStringForKey("EOJDBCDMMysqlPrototypesCopy", "erprototypes.EOPrototypesEntity");
readOnlyEOModelGroup = new ERXModelGroup();
((ERXModelGroup) readOnlyEOModelGroup).loadModelsFromLoadedBundles();
java.util.Enumeration enumerator = readOnlyEOModelGroup.models().objectEnumerator();
while (enumerator.hasMoreElements()) {
EOModel model = (EOModel)enumerator.nextElement();
NSMutableDictionary dictMut = model.connectionDictionary().mutableClone();
String connectionString = (String) model.connectionDictionary().valueForKey("URL");
connectionString = connectionString.replaceAll(ERXProperties.stringForKey("dm.legalsounds.LSBusinessLogic.readOnlyConnectionPattern"), ERXProperties.stringForKey("dm.legalsounds.LSBusinessLogic.readOnlyConnectionSubstitution"));
dictMut.takeValueForKey (connectionString, "URL");
model.setConnectionDictionary(dictMut.immutableClone());
}
}
return readOnlyEOModelGroup;
}
public EOEditingContext newReadOnlyEditingContext() {
if (readOnlyObjectStoreCoordinator == null) {
readOnlyObjectStoreCoordinator = new ERXObjectStoreCoordinator();
EOModelGroup.setModelGroupForObjectStoreCoordinator(readOnlyObjectStoreCoordinator, readOnlyEOModelGroup());
}
return ERXEC.newEditingContext(readOnlyObjectStoreCoordinator);
}
_______________________________________________
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