I've got a bizarre error that I'm struggling to debug. Wondering if anyone
can give me a point in the right direction...?


I've got a pretty boring fetch spec, and if i call this:


NSArray batch = ec.objectsWithFetchSpecification(fs);


... i get an array of objects. No issue. But I've been working on improving
the performance of this piece of code because sometimes the array can be
huge. So, I decide to introduce my usual
favorite ERXFetchSpecificationBatchIterator. However, when I call this (in
place of the above):


ERXFetchSpecificationBatchIterator fsbi =
newERXFetchSpecificationBatchIterator(fs, ec);


I get an immediate exception:


java.lang.IllegalStateException: Cannot obtain globalId for an object which
is registered in an other than the databaseContext's active editingContext,
object: Stormking Ltd 70 er.extensions.eof.er...@7e9482, databaseContext:
er.extensions.eof.erxdatabasecont...@d6db5b, object's editingContext:
er.extensions.eof.er...@7e9482, databaseContext's active editingContext:
er.extensions.eof.er...@748f91


The full stack trace is as follows, which hints that it's not liking
generating the actual SQL needed for the fetch:


     at
com.webobjects.eoaccess.EODatabaseContext._globalIDForObject(EODatabaseContext.java:4847)
     at
com.webobjects.eoaccess.EODatabaseContext.databaseOperationForObject(EODatabaseContext.java:4964)
     at
com.webobjects.eoaccess.EODatabaseContext.valuesForKeys(EODatabaseContext.java:6701)
     at
com.webobjects.eocontrol.EOObjectStoreCoordinator.valuesForKeys(EOObjectStoreCoordinator.java:341)
     at
com.webobjects.eoaccess.EOQualifierSQLGeneration$_KeyValueQualifierSupport.schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:418)
     at
er.extensions.ERXExtensions$KeyValueQualifierSQLGenerationSupport.schemaBasedQualifierWithRootEntity(ERXExtensions.java:315)
     at
com.webobjects.eoaccess.EOQualifierSQLGeneration$Support._schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:165)
     at
com.webobjects.eoaccess.EOQualifierSQLGeneration$_AndQualifierSupport.schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:502)
     at
com.webobjects.eoaccess.EOQualifierSQLGeneration$Support._schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:165)
     at
com.webobjects.eoaccess.EOQualifierSQLGeneration$_AndQualifierSupport.schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:502)
     at
com.webobjects.eoaccess.EOQualifierSQLGeneration$Support._schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:165)
     at
com.webobjects.eoaccess.EOEntity.schemaBasedQualifier(EOEntity.java:4423)
     at
er.extensions.eof.ERXFetchSpecificationBatchIterator.<init>(ERXFetchSpecificationBatchIterator.java:136)
     at
er.extensions.eof.ERXFetchSpecificationBatchIterator.<init>(ERXFetchSpecificationBatchIterator.java:104)
     at
er.extensions.eof.ERXFetchSpecificationBatchIterator.<init>(ERXFetchSpecificationBatchIterator.java:91)
     at com.clicktravel.mi.utilities.RawData.insert(RawData.java:203)
     at com.clicktravel.mi.workbooks.DataDump.build(DataDump.java:44)
     at
com.clicktravel.mi.workbooks.ClickClientAnalysis.build(ClickClientAnalysis.java:31)
     at
com.clicktravel.travelsystem.AsposeReportTemplate$InternalThread.run(AsposeReportTemplate.java:42)


So i stuck a load of debugging in to look at the editing contexts involved
in building the qualifier.


The editing context referenced as "ec" is this:


er.extensions.eof.er...@7e9482


... and the qualifier looks like this:


<class
com.webobjects.eocontrol.EOFetchSpecification(entityName=HotelVoucher,

 qualifier=((serviceDate between
(com.webobjects.foundation.NSTimestamp)'2009-03-01 00:00:00 Etc/GMT' and
(com.webobjects.foundation.NSTimestamp)'2009-03-31 00:00:00 Etc/GMT') and
((itinerary.organisation = (com.clicktravel.travelsystem.Client)'Stormking
Ltd 70 er.extensions.eof.er...@7e9482') and (status <> 2) and ((privacy =
(java.lang.Boolean)'false') or (((user =
(com.clicktravel.travelsystem.Employee)'Ms Beth Oleary 3327
er.extensions.eof.er...@7e9482') or (itinerary.user =
(com.clicktravel.travelsystem.Employee)'Ms Beth Oleary 3327
er.extensions.eof.er...@7e9482')) and (privacy =
(java.lang.Boolean)'true'))))),

 isDeep=true, usesDistinct=false,

 sortOrdering=null,

 hints=null,

 _prefetchingRelationshipKeyPaths = null)>


... as you can see, all the EO's referenced in the qualifier are all
residing in the same EC (er...@7e9482).


So, the question is where could this other editing context (er...@748f91) come
from ?


Thanks, Simon
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to