• 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
Rép : Prefetching many-to-many relationship [Solved]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Rép : Prefetching many-to-many relationship [Solved]


  • Subject: Rép : Prefetching many-to-many relationship [Solved]
  • From: Jean Pierre Malrieu <email@hidden>
  • Date: Wed, 21 Jan 2009 20:36:07 +0100


The problem described in my previous post only happens when you build a fetch spech on a relation, and then attempt to prefetch another, flattened, many-to-many relationship.

I found the solution in a rather old post by P. Robinson:

http://wodeveloper.com/omniLists/eof/2000/September/msg00099.html

The following code works:

     EOQualifier qual = Observation.INDICATOR.is(indicator);
     EOEntity myEntity = EOModelGroup.defaultGroup().entityNamed(Observation.ENTITY_NAME);
     qual = myEntity.schemaBasedQualifier(qual);
     EOFetchSpecification fs = new EOFetchSpecification(Observation.ENTITY_NAME,qual,null);
     fs.setPrefetchingRelationshipKeyPaths(new NSArray(new String[] {"dimensions"}));
     observations = indicator.editingContext().objectsWithFetchSpecification(fs);

The obligation of building a schema-based qualifier is a bug I guess, and I am a bit disappointed it has not been fixed in 8 years...

JPM

Le 3 nov. 08 à 22:33, Jean Pierre Malrieu a écrit :

Hi,

I have many-to-many relationship between entity Observation and entity Dimension.
This many-to-many is flattened.

I am fetching observations, trying to prefetch the "dimensions" relationship:

     EOQualifier qual = Observation.Indicator.is(indicator);
     EOFetchSpecification fs = new EOFetchSpecification(Observation.ENTITY_NAME,qual,null);
     fs.setPrefetchingRelationshipKeyPaths(new NSArray(new String[] {"dimensions"}));
     observations = indicator.editingContext().objectsWithFetchSpecification(fs);

I am getting the following exception:

java.lang.IllegalStateException: sqlStringForKeyValueQualifier: attempt to generate SQL for com.webobjects.eocontrol.EOKeyValueQualifier (observation.series = (com.fylab.educstat.eos.Series)'<com.fylab.educstat.eos.Series pk:"1000001">') failed because attribute identified by key 'observation.series' was not reachable from from entity 'DimensionObservation'






 _______________________________________________
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

  • Follow-Ups:
    • Re: Rép : Prefetching many-to-many relationship [Solved]
      • From: Chuck Hill <email@hidden>
  • Prev by Date: Re: last chance for stable
  • Next by Date: Re: Rép : Prefetching many-to-many relationship [Solved]
  • Previous by thread: Re: EOF Oracle function call
  • Next by thread: Re: Rép : Prefetching many-to-many relationship [Solved]
  • Index(es):
    • Date
    • Thread