I stumbled across a known bug in the loading of shared EOs when an
App uses multiple models. I got it working now, so this post is more
to add some info for future reference and maybe have some WO-guru
look into it. ;-)
Unlike the case of Francis Labrie [1], changing the model load order
did not help in my case. However, the ERXSharedEOLoader [2],
originally written by Kelly Hawks, did. Kelly's description of the
situation, as quoted in the class, does not match mine. I actually
have EOs that are shared in each of two models. With this setup, I get:
INFO 11:04:55 14,99 MB used/6,81 MB free
er.transaction.adaptor.Exceptions:85 - JDBC Exception occured:
java.lang.IllegalStateException: sqlStringForKeyValueQualifier:
attempt to generate SQL for
com.webobjects.eocontrol.EOKeyValueQualifier (myAttribute =
'myValue') failed because attribute identified by key 'myAttribute'
was not reachable from from entity 'sharedEO1'
This is the same problem Francis ran into. In my case I've got a Foo
object in Model A, which has a relation to a Bar object in Model B.
Bar has a relation to Baz (Model B) and Baz has relations to two
shared EOs, sharedEO1 and sharedEO2 (both Model B). This triggers the
exception:
Instead of just fetching Foo records matching the given attribute,
the code results in a fetch for each of the shared EOs. This is I can
understand, but then, a fetch is prepared for the Foo entity, which
looks like this when logged at
PostgresqlExpression.prepareSelectExpressionWithAttributes():
I don't really know what is happening here, but what I see is that
the attributes listed, all belong to sharedEO2, while the entityName
is correctly set to "Foo". So, somehow the attributes of the last
fetch for all instances of sharedEO2 end up in the fetch for Foo and
the fetch is recognised to be for entity sharedEO2 - albeit the
correctly set entityName.
On subsequent invocations, the attributes all belong to "Foo" and the
fetch completes normally.
I've had enough for today and won't look into this any further. Maybe
somebody gets some clues from my notes...
cheers
Fabian
P.S.: These are the call stacks for the fetch for "sharedEO1":
_______________________________________________
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