On 4/15/2013 3:57 PM, Pinaki Poddar wrote:
> The scope of EntityGraph should be persistence unit, not persistence context.
>
It is. However, an EntityGraph that is a mutable copy of a named entity graph can
be retrieved via the createEntityGraph method, modified, and then added back to the EMF
to replace the original one. Given the use cases for entity graphs, it seemed reasonable
that they should be able to be retrieved via the EntityManager.
> The method such as EntityManager.createEntityGraph(String name) etc. looks non-intuitive. If an application wants to
> create a graph at runtime, it should call EntityManagerFactory.createEntityGraph(String name).
>
> As the API currently stands, it seems to allow EntityGraph of the same name be defined by two separate persistence
> contexts -- opening up a pandora's box of confusion. It is much safer to define these graphs scoped at
> EntityManagerFactory level and imposing uniqueness on the name of the graphs.
>
>
>
>
> Regards --
>
> Pinaki Poddar
> Chair, Apache OpenJPA Project http://openjpa.apache.org/
> JPA Expert Group Member
> Application & Integration Middleware
>
>
>
>