Ah, now I remember the discussion. So, you can always open a UoW later and it will work (dependent on Visibility rules) for both the Entity and Value case.
But we also discussed whether we could introduce some other ways to capture the downstream entities somehow. One idea would be to have a "toValue() transitively", where the whole object graph is converted. That would imply that Association meta types could return Values, which is a big step. But it would also be a challenge to traverse a large graph, possibly cyclic in nature. Another idea that you brought up was that associations that had been referenced would keep a cached entity around and there be able to still be accessible. That is "impure" as there is nothing stopping those entities for being updated, so they are suddenly more like a Transient than an Entity. I don't like that. Finally, the inconsistency was to the fact that the Entity properties were accessible after the UnitOfWork is closed. And to restore "consistency" I suggest that this would result in the same Exception as when accessing the Associations, to force people to a "do the right thing" (no entity access outside UnitOfWork). Cheers Niclas On Fri, Jun 23, 2017 at 5:05 PM, Tibor Mlynarik <[email protected]> wrote: > Hi folks, > > After UoW is closed, traversal through association is not possible. > So there is no way how access associated data if I have only reference to > root of graph. > (also toValue() will not help) > > I think it is too restrictive, see > https://gist.github.com/tbml/b9b4af6e1d63593edd30f0fb1824006a < > https://gist.github.com/tbml/b9b4af6e1d63593edd30f0fb1824006a> > > Or is there other way ? > > thanks, > > Tibor -- Niclas Hedhman, Software Developer http://polygene.apache.org - New Energy for Java
