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.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

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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to