Re: ERXFetchSpecificationBatchIterator : Cannot obtain globalId for an object which is registered in an other than the databaseContext's active editingContext
Re: ERXFetchSpecificationBatchIterator : Cannot obtain globalId for an object which is registered in an other than the databaseContext's active editingContext
- Subject: Re: ERXFetchSpecificationBatchIterator : Cannot obtain globalId for an object which is registered in an other than the databaseContext's active editingContext
- From: Lachlan Deck <email@hidden>
- Date: Tue, 3 Mar 2009 06:45:09 +1100
On 02/03/2009, at 10:46 PM, Simon McLean wrote:
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 decide to introduce my usual
favorite ERXFetchSpecificationBatchIterator.
Good.
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.ERXEC@7e9482,
databaseContext:
er.extensions.eof.ERXDatabaseContext@d6db5b, object's editingContext:
er.extensions.eof.ERXEC@7e9482, databaseContext's active
editingContext:
er.extensions.eof.ERXEC@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
Does your qualifier include objects that have references to
uncommitted objects?
Does your qualifier include objects that have references to objects in
different ecs (accidentally)?
Did you forget to get a local copy of some object into the new ec?
Try doing this prior to calling the constructor:
EOEntity entity = EOUtilities.entityNamed(ec, fs.entityName());
EOQualifier schemaBasedQualifier =
entity.schemaBasedQualifier(fs.qualifier());
// just for fun
fs.setQualifier(schemaBasedQualifier)
Theoretically you should get the same exception because all the
constructor is doing is as follows:
{
EOEntity entity = ERXEOAccessUtilities.entityNamed(ec,
fetchSpecification.entityName());
<...>
this.fetchSpecification = (EOFetchSpecification)
fetchSpecification.clone();
<...>
setEditingContext(ec);
<...>
EOQualifier qualifier = this.fetchSpecification.qualifier();
if (qualifier != null) {
this
.fetchSpecification
.setQualifier(entity.schemaBasedQualifier(qualifier));
}
}
with regards,
--
Lachlan Deck
_______________________________________________
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