Skip to main content

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

  • From: Linda DeMichiel <linda.demichiel@...>
  • To: jsr338-experts@...
  • Subject: [jpa-spec users] [jsr338-experts] Re: scope of EntityGraphs
  • Date: Mon, 15 Apr 2013 16:37:51 -0700
  • List-id: <jsr338-experts.jpa-spec.java.net>
  • Organization: Oracle Corporation



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






[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