Your query fetches Garages and you do an alsoFetch: of wheels, but not of the cars. Maybe you have a retrieve: [:g | g car] that isn't mentioned in the mail, that would change the query output to cars. If you add
q alsoFetch: [:g | g car "or cars?"]
to the query (not to the mapping) does this help?
So you should have
Thomas
Freundliche Grüsse
Thomas Brodt
--Hi there,
I have this weird thing I don't understand. For a GUI component I issue a query like this (very simplified):
q := SimpleQuery read: Garage where: [:g| g cars anySatisfy: [:c| color = 'silver']].q alsoFetch: [:g| g car wheels asOuterJoin].
myCarCollection := self session execute: q.
Obviously, I am talking about a OneToManyRelationship here.
So once this collection of cars is read from the database, it is displayed in a list to the user. IN the list I want to display whether the car has wheels or not.
Now to the "funny" effect. Each car will then issue an SQL statement like this whenever the getter #cars of a Garage is accessed:
SELECT t1.id, ...
FROM WHEEL WHERE CAR_ID = "the id of a car"
So it seems that even though my initial search/query joins the Garage, Car and Wheel table, the cars will hold a Proxy in their wheels inst var.
In our not so simple productive case, this means that some lists take a long time to render because it issues a few hundred SQL statements for data that has already been read in the first query.
I already tried tried #shouldProxy: false in the OneToManyMapping for the car's wheels attribute, but to no avail. Even adding the alsoFetch: to the Garage's #cars mapping doesn't avoid these extra SQLs. (and it may be a tricky optimization that strikes back whenever the wheels of cars in a garage aren't needed....)
Any ideas what I can do?
Joachim
--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/04df8996-dc80-4be8-b034-c7ebf047532en%40googlegroups.com.
Free forum by Nabble | Edit this page |