db-jdo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Adams <matt...@matthewadams.me>
Subject JPA 2.1's fetch plan support
Date Thu, 13 Jun 2013 20:57:18 GMT
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 <matthew@matthewadams.me>
skype:matthewadams12
googletalk:matthew@matthewadams.me
http://matthewadams.me
http://www.linkedin.com/in/matthewadams

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message