Skip to main content

[jpa-spec users] [jsr338-experts] Re: scope of EntityGraphs

  • From: Pinaki Poddar <ppoddar@...>
  • To: jsr338-experts@...
  • Subject: [jpa-spec users] [jsr338-experts] Re: scope of EntityGraphs
  • Date: Mon, 15 Apr 2013 19:24:17 -0700
  • List-id: <jsr338-experts.jpa-spec.java.net>

Hello Linda,
  Thanks for explaining the usage. But I am afraid it looks confusing/non-intuitive to me.

1. If the graphs are in EMF scope, why the following method is on EM?
 
/**
* Return all named EntityGraphs that have been defined for the provided class type.
* @param entityClass entity class
* @return list of all entity graphs defined for the entity
* @throws IllegalArgumentException if the class is not an entity
*/
public <T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> entityClass);

2. If two entitymanagers separately call createEntityGraph(String egName) but with the same input argument, they get two separate mutable copies -- right?
Now if they mutate their respective copies differently and replace back to the EMF, which copy of the original graph wins?
The other entitymanagers later when gets the graph by the same name will now receive a graph with new structure -- right?  
So then what does immutability will signify in such case?

3. And above all, why all these needless complexity?



Regards --

Pinaki Poddar                          
Chair, Apache OpenJPA Project           http://openjpa.apache.org/
JPA Expert Group Member
Application & Integration Middleware






Inactive hide details for Linda DeMichiel ---04/15/2013 04:38:18 PM---On 4/15/2013 3:57 PM, Pinaki Poddar wrote: > The scope ofLinda DeMichiel ---04/15/2013 04:38:18 PM---On 4/15/2013 3:57 PM, Pinaki Poddar wrote: > The scope of EntityGraph should be persistence unit, no

From: Linda DeMichiel <linda.demichiel@...>
To: jsr338-experts@...
Date: 04/15/2013 04:38 PM
Subject: [jsr338-experts] Re: scope of EntityGraphs







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


GIF image



[jpa-spec users] [jsr338-experts] scope of EntityGraphs

Pinaki Poddar 04/15/2013

[jpa-spec users] [jsr338-experts] Re: scope of EntityGraphs

Linda DeMichiel 04/15/2013

[jpa-spec users] [jsr338-experts] Re: scope of EntityGraphs

Pinaki Poddar 04/16/2013
 
 
Close
loading
Please Confirm
Close