• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: EOQualifier.filterArrayWithQualifier weirdness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOQualifier.filterArrayWithQualifier weirdness


  • Subject: Re: EOQualifier.filterArrayWithQualifier weirdness
  • From: Lachlan Deck <email@hidden>
  • Date: Fri, 2 Feb 2007 10:38:04 +1100

Hi there,

On 02/02/2007, at 4:45 AM, Chuck Hill wrote:

On Feb 1, 2007, at 12:26 AM, Lachlan Deck wrote:

On 01/02/2007, at 5:44 PM, Lachlan Deck wrote:

I've got a weird bug I'm trying to figure out and I'm currently a little stumped. (Grab your coffee Chuck :-)

EntiyA <-->> Entity B <<--> Entity C

The story goes a little like this:

EOEditingContext ec; // assume exists
EntityA someA; // assume exists within ec
EntityA someC; // assume exists within ec
NSMutableArray bObjects;
EOQualifier qualifier;

Hmmm, okay so I'm attempting to localise someC from the shared ec.
someC = ( SomeC )EOUtilities.localInstanceOfObject( ec, someCFromSharedEc );


Bummer. Doesn't work...

I avoid the shared EC, however, IIRC,

ec.setSharedEditingContext(null);
someC = ( SomeC )EOUtilities.localInstanceOfObject( ec, someCFromSharedEc );


is what you want.

I'd already had that as a default for all my ecs. That's why I was a little baffled.


If I tried something similar like...
someC = ( SomeC )ec.objectsWithFetchSpecification( new EOFetchSpecification( SomeC.ENTITY_NAME, pkQualifier, null ) );
// or
someC = ( SomeC )EOUtilities.objectForPrimaryKeyValue( ec, SomeC.ENTITY_NAME, someCFromSharedEc.id() );
// or
someC = ( SomeC )ec.faultForGlobalID( someCFromSharedEc.globalID(), someCFromSharedEc.editingContext() );


I get an exception like:

java.lang.IllegalArgumentException: EOEditingContext: initializeObject: attempt to initialize object with global ID _EOIntegralKeyGlobalID[SomeC (java.lang.Long)3] that exists in a shared context via a non-shared context. The object model may have a relationship from a shared entity to a non-shared entity. Disable or remove the relationship from the model.
at com.webobjects.eocontrol.EOEditingContext.initializeObject (EOEditingContext.java:3739)
at com.webobjects.eoaccess.EODatabaseChannel $_EODatabaseChannelFetchResult.initializeObjects (EODatabaseChannel.java:479)
at com.webobjects.eoaccess.EODatabaseContext._objectsWithFetchSpecification EditingContext(EODatabaseContext.java:3231)
at com.webobjects.eoaccess.EODatabaseContext.objectsWithFetchSpecification( EODatabaseContext.java:3337)
at com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpecif ication(EOObjectStoreCoordinator.java:539)
at com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification( EOEditingContext.java:4053)
at com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification( EOEditingContext.java:4438)
<...>


So looks like I'll have to remove the relationship at runtime (when the application launches) from SomeC to entities that are non-shared as mentioned here <http://en.wikibooks.org/wiki/ Programming:WebObjects/EOF/Using_EOF/EOSharedEditingContext>

Oh well, that's the trade off for using the shared ec.

And ... ec.setStopSharedEditingContextRuiningEveryonesLife(true) has to be in ProjectWONDER doesn't it ;-)

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


References: 
 >Re: EOQualifier.filterArrayWithQualifier weirdness (From: Lachlan Deck <email@hidden>)
 >Re: EOQualifier.filterArrayWithQualifier weirdness (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Recording for PlaybackManager not working?
  • Next by Date: Re: Recording for PlaybackManager not working?
  • Previous by thread: Re: EOQualifier.filterArrayWithQualifier weirdness
  • Next by thread: Re: Suggestions for handling DoS attack, well kind of
  • Index(es):
    • Date
    • Thread