Hello Group,
I'm working on a flat file importer (groan). Creating EOs and writing to the database (Frontbase) seems to work fine. The objects I'm creating with the data have relationships like a tree structure with a single object (Certificate) at the top level followed by the next two tiers. There may be several hundred objects in the "tree", but 800 objects related to the top level Certificate would be enormous and extremely rare.
Sometimes my source data contains corrections. The most reliable way to handle them is to cascade delete the old objects and write new ones. There is nothing in my import correction data that tells me what has changed, so an edit seems pretty much out of the question. What I am finding is that EC.saveChanges after the delete tends to get slower the more of these I process. Eventually the database seems to hang-up; and by hang-up I mean, go to the DB management application and it says the database is stopped. I match certain data (dates, codes, etc) with the record I'm importing. If it matches I delete the one I have in the database before writing a new one. EC.deletedObjects just shows the one I am getting rid of. Here's the code. . .
// Cascade Delete Certificate to prepare for overwrite System.out.println("Cascading Delete Certificate"); recordContext.deleteObject(importCertificate); System.out.println("Updated Objects: " + recordContext.deletedObjects() + "\n"); System.out.println("Start Save: " + new NSTimestamp()); recordContext.saveChanges(); // <- Max 2 minutes, Min 5 sec, Avg 11 sec, longer times before crash System.out.println("End Save: " + new NSTimestamp());
This is the first exception I got. By this point I had cascade deleted 234 EO groups. After this I got similar exceptions whenever I called anything from EOUtilities.
java.lang.IllegalStateException: _obtainOpenChannel -- com.webobjects.eoaccess.EODatabaseContext com.webobjects.eoaccess.EODatabaseContext@aa1384: failed to open database channel. Check your connection dictionary, and ensure your database is correctly configured. at com.webobjects.eoaccess.EODatabaseContext._obtainOpenChannel(EODatabaseContext.java:2131) at com.webobjects.eoaccess.EODatabaseContext._objectsWithFetchSpecificationEditingContext(EODatabaseContext.java:3204) at com.webobjects.eoaccess.EODatabaseContext.objectsWithFetchSpecification(EODatabaseContext.java:3355) at com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpecification(EOObjectStoreCoordinator.java:539) at com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4114) at com.webobjects.eoaccess.EODatabaseContext.objectsForSourceGlobalID(EODatabaseContext.java:4260) at com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsForSourceGlobalID(EOObjectStoreCoordinator.java:682) at com.webobjects.eocontrol.EOEditingContext.objectsForSourceGlobalID(EOEditingContext.java:3965) at com.webobjects.eoaccess.EODatabaseContext._fireArrayFault(EODatabaseContext.java:4427) at com.webobjects.eoaccess.EOAccessArrayFaultHandler.completeInitializationOfObject(EOAccessArrayFaultHandler.java:70) at com.webobjects.eocontrol._EOCheapCopyMutableArray.willRead(_EOCheapCopyMutableArray.java:38) at com.webobjects.eocontrol._EOCheapCopyMutableArray.count(_EOCheapCopyMutableArray.java:92) at com.webobjects.eocontrol.EOClassDescription.propagateDeleteForObject(EOClassDescription.java:511) at com.webobjects.eocontrol.EOCustomObject.propagateDeleteWithEditingContext(EOCustomObject.java:688) at com.webobjects.eocontrol.EOClassDescription.propagateDeleteForObject(EOClassDescription.java:523) at com.webobjects.eocontrol.EOCustomObject.propagateDeleteWithEditingContext(EOCustomObject.java:688) at com.webobjects.eocontrol.EOEditingContext.propagateDeletesUsingTable(EOEditingContext.java:2231) at com.webobjects.eocontrol.EOEditingContext._processDeletedObjects(EOEditingContext.java:2193) at com.webobjects.eocontrol.EOEditingContext._processRecentChanges(EOEditingContext.java:1744) at com.webobjects.eocontrol.EOEditingContext._prepareForPushChanges(EOEditingContext.java:3257) at com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3213)
// Save changes line above at ImportProcess.ParseCertificate(ImportProcess.java:1080) at ImportProcess.HandleRDT(ImportProcess.java:801) at ImportProcess.HandleFileInput(ImportProcess.java:445) at ImportProcess.performAction(ImportProcess.java:216) at com.webobjects.woextensions.WOLongResponsePage.run(WOLongResponsePage.java:155) at java.lang.Thread.run(Thread.java:613)
Seen anything similar? Am I going about this the wrong way? Deleting and entering a fresh copy seemed like the way to go. I could dispose of my EC periodically if it would help. It contains some NSDictionary values to help speed the look-up process, but I could dump the EC and re-build the dictionaries if I had to.
Thanks for any help offered,
Scott
|