On Tue, Nov 10, 2020 at 3:25 PM jtuchel <
jtu...@objektfabrik.de> wrote:
>
> I guess you'd have to refresh all categires individually. like
>
> self session refresh: tournament.
> tournament categories do: [:c| self session refresh: c].
That I could do of course, but the point is that the categories
collection might have changed, not just each category.
Since some stuff is loaded in another system and then synchronized via
an API, it might be the case that in my Glorp session I have five
categories, but then a new update/sync came in and now there are only
three, completely different from the other ones. So the right thing
would be to re-read the whole collection of the ToMany mapping.
> I am not aware of a "mass refresh" that could bundle these statements into one select, so each category will be read individually (meaning 7 select statements for one tournament and 6 categories). But looking at #refresh: I could imagine this is not too hard to implement, as long as the new refreshAll: is only used for collections of objects of the same Class. And with a few hours more you could probably group the ids by descriptors and bundle the selects...
I think that removing the objects in the collection (each category)
from the registered objects and forcing the re query/instantiation of
the collection defined by that mapping would work.
With a proxied collection this would be simpler because by freeing the
value of the proxy and setting it as not instantiated it would cause
it to automatically instantiate it again.
One of my first experiments when doing my own ORM was to have all
object references intermediated by proxies for this very reason.
At this point this is beer talk, but if there were another Camp
Smalltalk there are a lot of improvements that could come out of these
talks. :-)
Regards,
Esteban A. Maringolo