You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by Michael Bouschen <mi...@akquinet.de> on 2013/06/14 18:23:54 UTC

Fwd: JPA 2.1's fetch plan support

Forward Email to jdo-dev.

Regards Michael


-------- Original-Nachricht --------
Betreff: 	JPA 2.1's fetch plan support
Datum: 	Thu, 13 Jun 2013 15:57:18 -0500
Von: 	Matthew Adams <ma...@matthewadams.me>
Antwort an: 	<jd...@db.apache.org>
An: 	<jd...@db.apache.org>



I've reviewed JPA 2.1's fetch plan support (I happen to be writing a JPA
course right now).  Quick synopsis (I'm pressed for time):

* Terminology:  JPA "EntityGraph" (EG) ~= JDO "FetchPlan"

* JPA EGs define graphs only

* They only apply to em.find(..) operations and queries, being given as hint

* Two kinds of hints:
   * "javax.persistence.fetchgraph" => *only* the attributes identified in
EG loaded; overrides any other fetching policies
   * "javax.persistence.loadgraph" =>guarantees that *at least* the
attributes identified in the EG; all other fetching policies apply
according to their user-specified values or JPA defaults

* EG definitions contain all attributes within the definition itself;
presents maintenance issue if you remove an attribute that was used in an EG

* Annotations are quite verbose:
@NamedEntityGraph(attributeNodes={@NamedAttributeNode("projects")})

* Can be specified in XML metadata (less verbosely)

* Can't specify graph depth, recursion or otherwise

* API form:  interface EntityGraph, etc

See JPA 2.1 specification, section 3.7, p.109 for more info.  I need to
review JDO's fetch plan support for comparison, as I don't remember some of
the details.

-matthew

-- 
mailto:matthew@matthewadams.me <ma...@matthewadams.me>
skype:matthewadams12
googletalk:matthew@matthewadams.me
http://matthewadams.me
http://www.linkedin.com/in/matthewadams