You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@polygene.apache.org by Tibor Mlynarik <ti...@gmail.com> on 2017/06/23 09:05:31 UTC

UnitOfWork closed inconsistently

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

Re: UnitOfWork closed inconsistently

Posted by Paul Merlin <pa...@apache.org>.
Niclas Hedhman a écrit :
> 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).

+1 from me


Re: UnitOfWork closed inconsistently

Posted by Niclas Hedhman <ni...@hedhman.org>.
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 <ti...@gmail.com>
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