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"

 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{EclipseLink_TLJPA
+
#REDIRECT [[EclipseLink/UserGuide/JPA/2.4/toc]]
|info=n
+
|toc=n
+
|category=JPA
+
|release=2.4.x
+
|title= }}
+
<span class="metaname">    </span>
+
 
+
{| class="simple oac_no_warn" width="100%"
+
| align="left" valign="top" | 
+
| width="144" align="right" valign="bottom" |
+
{| class="simple oac_no_warn" width="100%"
+
|
+
| align="center" valign="top" |
+
[http://www.google.com/cse/home?cx=016171230611334810008:y5kxq4rqd8s&hl=en Search]
+
| align="center" valign="top" |
+
[[EclipseLink/UserGuide/JPA/toc| Contents]]
+
|}
+
|}
+
 
+
----
+
 
+
{| width="150"
+
| align="center" |
+
[[EclipseLink/UserGuide/JPA/a_array|&lt;- Previous]]
+
| align="center" |
+
[[EclipseLink/UserGuide/JPA/a_cache|Next -&gt;]]
+
|
+
|}
+
 
+
<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="sthref27"></span>
+
 
+
''' '''
+
 
+
===Annotation Elements===
+
 
+
[[#CHDJBJBC|Table 2-1]] describes this annotation's elements.
+
 
+
<span id="sthref28"></span><span id="CHDJBJBC"></span>
+
 
+
'''''Table 2-1 @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-t2" align="left" valign="bottom" | '''Annotation Element'''
+
! id="r1c2-t2" align="left" valign="bottom" | '''Description'''
+
! id="r1c3-t2" align="left" valign="bottom" | '''Default'''
+
|- align="left" valign="top"
+
| id="r2c1-t2" headers="r1c1-t2" align="left" |
+
size
+
| headers="r2c1-t2 r1c2-t2" 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-t2 r1c3-t2" align="left" |
+
<code>256</code> or the query's <code>pageSize</code> (for cursor queries)
+
|- align="left" valign="top"
+
| id="r3c1-t2" headers="r1c1-t2" align="left" |
+
BatchFetchType
+
| headers="r3c1-t2 r1c2-t2" align="left" |
+
(optional) The type of batch fetch to use:
+
 
+
* JOIN
+
* EXISTS
+
* IN
+
| headers="r3c1-t2 r1c3-t2" align="left" |
+
JOIN
+
|}
+
 
+
<br />
+
 
+
<span id="sthref29"></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="sthref30"></span>
+
 
+
''' '''
+
 
+
===Examples===
+
 
+
Para.
+
 
+
<span id="sthref31"></span>
+
 
+
'''''Example 2-1 Using JOIN BatchFetch Type'''''
+
 
+
+
 
+
<span id="sthref32"></span>
+
 
+
'''''Example 2-2 Using EXISTS BatchFetch Type'''''
+
 
+
+
 
+
<span id="sthref33"></span>
+
 
+
'''''Example 2-3 Using IN BatchFetch Type'''''
+
 
+
+
 
+
<span id="sthref34"></span>
+
 
+
''' '''
+
 
+
===See Also===
+
 
+
For more information, see:
+
 
+
* [[EclipseLink/UserGuide/JPA/a_joinfetch|"@JoinFetch"]]
+
 
+
----
+
 
+
{| class="simple oac_no_warn" width="100%"
+
|-
+
| valign="bottom" |
+
{| width="150"
+
|-
+
|
+
| align="center" |
+
[[EclipseLink/UserGuide/JPA/a_array|&lt;- Previous]]
+
| align="center" |
+
[[EclipseLink/UserGuide/JPA/a_cache|Next -&gt;]]
+
|}
+
| width="34%" align="center" |
+
[[Image:Eclipselink-logo.gif|150px|EclispeLink]]<br />[http://wiki.eclipse.org/EclipseLink EclipseLink Home]<br />
+
| align="right" valign="bottom" |
+
{| class="simple oac_no_warn" width="225"
+
|
+
| align="center" valign="top" |
+
[http://www.google.com/cse/home?cx=016171230611334810008:y5kxq4rqd8s&hl=en Search]
+
| align="center" valign="top" |
+
[[EclipseLink/UserGuide/JPA/toc| Contents]]
+
|}
+
|}
+

Latest revision as of 12:22, 29 June 2012

Back to the top