Hello Adam,
Would the "dirty" set include unsynchronized persisted and removed
Entities? It would likely be better to have separate sets for these.
Without configuration these sets would have to be cleared as the
EntityManager is cleared. What effect do you see EntityManager.clear()
having on these sets?
As an alternative to the sets an EntityManager lifecycle listener
could be notified of the sets on EntityManager.flush() and the
application could track the same sets as need across flushes.
--Gordon
Adam Bien wrote:
> HI All,
>
> I would like to propose additional EntityManager methods:
>
> Set<Class> updated = EntityManager#getUpdatedEntities(Class<T>.class);
> Set<Class> deleted = EntityManager#getDeletedEntities(Class<T>.class);
> Set<Class> created = EntityManager#getCreatedEntities(Class<T>.class);
> Set<Class> dirty = EntityManager#getDirty(Class<T>.class);
>
> We had to use provider-specific EntityManager extensions to access the dirty entities for the implementation of replication or historization.
>
> Such methods would be also useful for debugging purposes,
>
> thanks in advance,
>
> adam
>
>
>