On Sep 23, 2008, at 11:24 AM, Sergio Sánchez Maffet wrote:

Hi all,

I have noticed a failure in the handling of prefetched flattened relationships using WONDER (latest) with WO 5.4.3

In general, I would describe pre-fetching as buggy. It works in simple cases, but gets confused if you go beyond that.

Consider switching to ERXBatchFetchUtilities.


Model:
My1Entity (class My1Entity)
To one relationships: my3entity destination My3Entity
To many relationships: my2entities (flattened relationship) destination My2Entity

My2Entity (class My2Entity)
To many relationships: my1entities (flattened relationship) destination My1Entity

MyJoinEntity (EOGenericRecord, not visible)
To one relationships: my1Entity destination My1Entity, my2Entity destination My2Entity

My3Entity (class My3Entity)
To many relationships: my1entities destination My1Entity

Now I want to fetch My1Entity objects, with the following qualifier: "my3entity = %@", new NSArray<My3Entity>(a3EntityObject)

If you fetch now, there is no problem.
But if you set to prefetch my2entities (!) of My1Entity with setPrefetchingRelationshipKeyPaths(new NSArray<String>("my2entities")) you got an exception like this one:

java.lang.IllegalStateException: sqlStringForKeyValueQualifier: attempt to generate SQL for com.webobjects.eocontrol.EOKeyValueQualifier (my1Entity. my3entity = (MyEO2)'...') failed because attribute identified by key 'my1Entity. my3entity' was not reachable from from entity 'MyJoinEntity'

One thing I notice is that there seems to be a space between "my1Entity." and "my3entity". Is that from copy and paste, or is that in your model?



This completely is weird, my1Entity. my3entity is reachable from MyJoinEntity (EOGenericRecord), but the attribute identified by key 'my1Entity. my3entity' is not an attribute/key but a key path!

I am not sure if that is the problem or just a poorly written message.


Until now, I have not done any further investigations... it was working without WONDER and WO 5.4.2 and .3

Is it obligatory to use ERXGenericRecord?
Any clues?


ERXGenericRecord should not be affecting this.

Chuck


--
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      ([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