I'm using atomic conversation with entityManager.flush() being called manually.
In such a conversation I can do many things with my entities, eg.:
- create new objects and persist them <- it's OK
- remove some persistent objects -< it's OK
- create and then remove not yet persisted objects!!! <- FATAL [application] javax.persistence.EntityNotFoundException: deleted entity passed to persist
How to easily manage all these operations with entities to avoid errors mentioned above?
Atomic conversations + ajax give us enough "time" to do many complicated things with entities before final flush() is being performed, but I can't find easy way to manage all this operations to extract final set of objects to persist, remove and so on.
How to handle this issue?
Slawek