jsr338-experts@jpa-spec.java.net

[jsr338-experts] Re: Standardized Access to ChangeSet

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Mon, 20 Jun 2011 15:12:40 -0300

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
>
>
>