On Tue, Sep 8, 2009 at 4:49 PM, Niclas Hedhman <[email protected]> wrote:

> If the entity is created within the same uow session that calls the
> uow.remove(), then there will be an exception that the entity doesn't
> exist. I think it is due to
> UnitOfWorkInstance.remove( entity ) doesn't remove the instanceCache
> entry, but not totally sure.

Further digging shows that the EntityStoreUnitOfWork will have had a
newEntityState() called, but there is no equivalent for the
uow.remove(entity), so although the entity is removed from the
UnitOfWorkInstance, it is hanging around in the ESUoW and the status()
for the entity is marked REMOVED so when the ES commit() reaches the
MapEntityStore.MapChanger.removeEntity() implementation, there is no
entity since before to remove, so it tosses the
EntityNotFoundException.


I suggest that we remove that exception, i.e. it is Ok to remove an
Entity that "doesn't exist", and that we add these tests to the
EntityStore test suite.


Cheers
-- 
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I  live here; http://tinyurl.com/2qq9er
I  work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to