On Fri, Mar 6, 2009 at 9:50 AM, Rickard Öberg <[email protected]> wrote:
> BUT, one implementation detail I'm stumbling on is this scenario: > A base UoW is created in a Module that sees NO Entities whatever. > A call is made to a Service in a Module which *does* see Entities. The > service does UoW.nestedUnitOfWork() and does find() on an Entity. The > Service works on the Entity, completes the nestedUnitOfWork() and then > returns. The outer code then does UoW.complete(). Again, note that the > calling code doesn't "see" the Entity, from a Module visibility point of > view. > > Question: > When the Service finds() the Entity, should the EntityState be > force-loaded into the parent UoW? Meaning, if another nested UoW loads > the same Entity it will see the state of it as it was when it was > find()'ed the first time. Or, should the state only be loaded into the > nested UoW and ONLY upon complete() is it merged back into the parent > UoW so that the parent and other nested UoW's can see it? I am not sure exactly what use-case you are talking about it here. But the UoW will act as an EntityStore, which means that; 1. childUOW1 reads E1. 2. childUOW1 reads E2. 3. childUOW1 modifies E2. 4. childUOW2 reads E1. 5. childUOW2 changes E1. 6. childUOW2 completes 7. childUOW1 completes <-- ConcurrentModification The parent UOW will need to be able to detect step7 and throw a modification exception. I am not totally sure, but to me that feels like any "read Entity" inside a nested UoW must be 'loaded' in the parent UoW, but I am not sure. Cheers Niclas -- http://www.qi4j.org - New Energy for Java _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

