Rép : Prefetching many-to-many relationship [Solved]
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:
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