Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/UserGuide/JPA/2.4/a batchfetch"

m
 
Line 1: Line 1:
{{EclipseLink_TLJPA
+
#REDIRECT [[EclipseLink/UserGuide/JPA/2.4/toc]]
|info=n
+
|toc=n
+
|category=JPA
+
|release=2.4.x
+
|title=TLJPA }}
+
<span class="metaname">    </span>
+
 
+
{| class="simple oac_no_warn" width="100%"
+
| align="left" valign="top" | 
+
| width="185" align="right" valign="bottom" |
+
{| class="simple oac_no_warn" width="100%"
+
|
+
| align="center" valign="top" |
+
[[Image:Elug_Magnifier.png|Search]][http://www.google.com/cse/home?cx=016171230611334810008:y5kxq4rqd8s&hl=en Search]
+
| align="center" valign="top" |
+
&nbsp;&nbsp;&nbsp;[[Image:Elug_guide_icon.png|Contents]][[EclipseLink/UserGuide/JPA/2.4/toc| Contents]]
+
|}
+
|}
+
 
+
----
+
 
+
{| width="165"
+
| align="center" |
+
[[EclipseLink/UserGuide/JPA/2.4/a_array| Previous ]]<span class="previouslink">[[Image:Elug_previous_icon.png|Previous]]</span>
+
| align="center" |
+
[[EclipseLink/UserGuide/JPA/2.4/a_cache| Next ]][[Image:Elug_next_icon.png|Next]]
+
|
+
|}
+
 
+
[[Image:Elug_draft_icon.png|Warning]]Beta Draft: 2012-06-18
+
 
+
<span id="CHDCCIDA"></span>
+
 
+
----
+
 
+
==@BatchFetch==
+
 
+
Use <code>@BatchFetch</code> to read objects related to a relationship mapping (such as one-to-one, one-to-many, many-to-one, many-to-many, and element collection) to be read in a single query.
+
 
+
<span id="sthref25"></span>
+
 
+
''' '''
+
 
+
===Annotation Elements===
+
 
+
[[#CHDJBJBC|Table 2-3]] describes this annotation's elements.
+
 
+
<span id="sthref26"></span><span id="CHDJBJBC"></span>
+
 
+
'''''Table 2-3 @BatchFetch Annotation Elements'''''
+
 
+
{| class="HRuleFormalWide" dir="ltr" title="@BatchFetch Annotation Elements" summary="This table describes the list of attributes for this annotation." width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
+
|- align="left" valign="top"
+
! id="r1c1-t6" align="left" valign="bottom" | '''Annotation Element'''
+
! id="r1c2-t6" align="left" valign="bottom" | '''Description'''
+
! id="r1c3-t6" align="left" valign="bottom" | '''Default'''
+
|- align="left" valign="top"
+
| id="r2c1-t6" headers="r1c1-t6" align="left" |
+
size
+
| headers="r2c1-t6 r1c2-t6" align="left" |
+
Default size of the batch fetch, used only when <code>BatchFetchType</code>=<code>IN</code> to definite number of keys in each <code>IN</code> clause
+
| headers="r2c1-t6 r1c3-t6" align="left" |
+
<code>256</code> or the query's <code>pageSize</code> (for cursor queries)
+
|- align="left" valign="top"
+
| id="r3c1-t6" headers="r1c1-t6" align="left" |
+
BatchFetchType
+
| headers="r3c1-t6 r1c2-t6" align="left" |
+
(optional) The type of batch fetch to use:
+
 
+
* JOIN
+
* EXISTS
+
* IN
+
| headers="r3c1-t6 r1c3-t6" align="left" |
+
JOIN
+
|}
+
 
+
<br />
+
 
+
<span id="sthref27"></span>
+
 
+
''' '''
+
 
+
===Usage===
+
 
+
Batch fetching allows for the optimal loading of a tree. Setting the <code>@BatchFetch</code> annotation on a ''child'' relationship of a tree structure causes EclipseLink to use a ''single'' SQL statement for each level.
+
 
+
<span id="sthref28"></span>
+
 
+
''' '''
+
 
+
===Examples===
+
 
+
The following examples show how to use this annotation with different batch fetch types.
+
 
+
<span id="sthref29"></span>
+
 
+
'''''Example 2-7 Using JOIN BatchFetch Type'''''
+
 
+
+
+
+
 
+
<span id="sthref30"></span>
+
 
+
'''''Example 2-8 Using EXISTS BatchFetch Type'''''
+
 
+
+
+
+
 
+
<span id="sthref31"></span>
+
 
+
'''''Example 2-9 Using IN BatchFetch Type'''''
+
 
+
+
+
+
 
+
<span id="sthref32"></span>
+
 
+
''' '''
+
 
+
===See Also===
+
 
+
For more information, see:
+
 
+
* [[EclipseLink/UserGuide/JPA/2.4/a_joinfetch|"@JoinFetch"]]
+
 
+
<span id="footerspace"> </span>
+
 
+
----
+
 
+
{| class="simple oac_no_warn" width="100%"
+
|-
+
| valign="bottom" |
+
{| width="165"
+
|-
+
|
+
| align="center" |
+
[[EclipseLink/UserGuide/JPA/2.4/a_array| Previous ]]<span class="previouslink">[[Image:Elug_previous_icon.png|Previous]]</span>
+
| align="center" |
+
[[EclipseLink/UserGuide/JPA/2.4/a_cache| Next ]][[Image:Elug_next_icon.png|Next]]
+
|}
+
| width="34%" align="center" |
+
[[Image:Eclipselink-logo.gif|150px|EclispeLink]]<br />[[Image:Elug_home_icon.png|EclipseLink logo]] [http://www.eclipse.org/eclipselink/ EclipseLink Home] • [[Image:Elug_pdf.png|PDF]] PDF (coming soon)<br />
+
| align="right" valign="bottom" |
+
{| class="simple oac_no_warn" width="225"
+
|
+
| align="center" valign="top" |
+
[[Image:Elug_Magnifier.png|Search]][http://www.google.com/cse/home?cx=016171230611334810008:y5kxq4rqd8s&hl=en Search]
+
| align="center" valign="top" |
+
&nbsp;&nbsp;&nbsp;[[Image:Elug_guide_icon.png|Contents]][[EclipseLink/UserGuide/JPA/2.4/toc| Contents]]
+
|}
+
|}
+

Latest revision as of 12:22, 29 June 2012

Back to the top