On Jan 21, 2009, at 11:36 AM, Jean Pierre Malrieu wrote:


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

It certainly looks like a bug to me.  Have you reported this to Apple?

Thanks for the followup, I think this exact problem is somewhere on my "Bugs to Look At" list for this project.

Chuck


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      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net

This email sent to ch...@global-village.net

--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to