openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <ppod...@apache.org>
Subject Re: Fetch Group questions
Date Thu, 31 Jul 2008 00:12:51 GMT

Hi,
> 1. Is the "default" fetch group ALWAYS active? 
Almost ALWAYS. Unless you really, seriously do not want it, force removal by
   FetchPlan.removeFetchGroup(FetchGroup.NAME_DEFAULT);

after clearFetchGroup(), it will still load the fields of default fetch
group
after resetFetchGroup(), it will load the default + any other configured
fetch groups.

> 2. Is there any way to configure OpenJPA to NOT eagerly fetch direct
> relations

OpenJPA is not really 'fetching' the direct relation unless it is included
in the fetch group. If a row for A is read from database and row(A) contains
foreign keys to row(B) and row(C) (as the case may be for direct to-one
mappings), then those FK values are read and stored in a way that is
invisible to user application. The reference A.b or A.c is not populated.
The intermediate storage of foreign keys optimizes any subsequent traversal
of A.b and A.c without a join. 

Once A has lots of to-one relations, it is a valid concern that A will store
a lot of FK values in intermediate storage (perhaps without ever using
them), but just wanted to underline that there is no significant performance
penalty in such cases as the values are read from an existing row. 


> 3. When I do FetchPlan.addField() for a @ManyToMany or a
> @PersistentCollection(elementEmbedded = true) field, there is no eager
> fetching (like when the same field has FetchType.EAGER)... Should this
work? Can somebody point to any examples or test cases for this? Do we need
to fiddle with the EagerFetchMode join/parallel??

Not sure I understand the question -- can you please elaborate?
 
> a) in other words, query caching uses the Fetch Group as cache key)
No. 

> b) only the "missing" columns are fetched and "merged" ?
No. 
If fetch plan is the only thing that is different between query Q1 and Q2
and QueryCache is enabled,  executing Q1 followed by Q2 will produce an
incorrect behavior. OpenJPA will consider Q2 as the same as cached version
Q1 and will never apply fetch plan of Q2. 


-- 
View this message in context: http://n2.nabble.com/Fetch-Group-questions-tp534861p661340.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message