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.
Difference between revisions of "EclipseLink/UserGuide/JPA/2.4/a batchfetch"
m |
|||
Line 4: | Line 4: | ||
|category=JPA | |category=JPA | ||
|release=2.4.x | |release=2.4.x | ||
− | |title= }} | + | |title=TLJPA }} |
<span class="metaname"> </span> | <span class="metaname"> </span> | ||
{| class="simple oac_no_warn" width="100%" | {| class="simple oac_no_warn" width="100%" | ||
| align="left" valign="top" | | | align="left" valign="top" | | ||
− | | width=" | + | | width="185" align="right" valign="bottom" | |
{| class="simple oac_no_warn" width="100%" | {| class="simple oac_no_warn" width="100%" | ||
| | | | ||
| align="center" valign="top" | | | align="center" valign="top" | | ||
− | [http://www.google.com/cse/home?cx=016171230611334810008:y5kxq4rqd8s&hl=en Search] | + | [[Image:Elug_Magnifier.png|Search]][http://www.google.com/cse/home?cx=016171230611334810008:y5kxq4rqd8s&hl=en Search] |
| align="center" valign="top" | | | align="center" valign="top" | | ||
− | [[EclipseLink/UserGuide/JPA/toc| Contents]] | + | [[Image:Elug_guide_icon.png|Contents]][[EclipseLink/UserGuide/JPA/2.4/toc| Contents]] |
|} | |} | ||
|} | |} | ||
Line 21: | Line 21: | ||
---- | ---- | ||
− | {| width=" | + | {| width="165" |
| align="center" | | | align="center" | | ||
− | [[EclipseLink/UserGuide/JPA/a_array| | + | [[EclipseLink/UserGuide/JPA/2.4/a_array| Previous ]]<span class="previouslink">[[Image:Elug_previous_icon.png|Previous]]</span> |
| align="center" | | | align="center" | | ||
− | [[EclipseLink/UserGuide/JPA/a_cache|Next | + | [[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> | <span id="CHDCCIDA"></span> | ||
Line 37: | Line 39: | ||
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. | 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=" | + | <span id="sthref25"></span> |
''' ''' | ''' ''' | ||
Line 43: | Line 45: | ||
===Annotation Elements=== | ===Annotation Elements=== | ||
− | [[#CHDJBJBC|Table 2- | + | [[#CHDJBJBC|Table 2-3]] describes this annotation's elements. |
− | <span id=" | + | <span id="sthref26"></span><span id="CHDJBJBC"></span> |
− | '''''Table 2- | + | '''''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" | {| 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" | |- align="left" valign="top" | ||
− | ! id="r1c1- | + | ! id="r1c1-t6" align="left" valign="bottom" | '''Annotation Element''' |
− | ! id="r1c2- | + | ! id="r1c2-t6" align="left" valign="bottom" | '''Description''' |
− | ! id="r1c3- | + | ! id="r1c3-t6" align="left" valign="bottom" | '''Default''' |
|- align="left" valign="top" | |- align="left" valign="top" | ||
− | | id="r2c1- | + | | id="r2c1-t6" headers="r1c1-t6" align="left" | |
size | size | ||
− | | headers="r2c1- | + | | 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 | 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- | + | | headers="r2c1-t6 r1c3-t6" align="left" | |
<code>256</code> or the query's <code>pageSize</code> (for cursor queries) | <code>256</code> or the query's <code>pageSize</code> (for cursor queries) | ||
|- align="left" valign="top" | |- align="left" valign="top" | ||
− | | id="r3c1- | + | | id="r3c1-t6" headers="r1c1-t6" align="left" | |
BatchFetchType | BatchFetchType | ||
− | | headers="r3c1- | + | | headers="r3c1-t6 r1c2-t6" align="left" | |
(optional) The type of batch fetch to use: | (optional) The type of batch fetch to use: | ||
Line 70: | Line 72: | ||
* EXISTS | * EXISTS | ||
* IN | * IN | ||
− | | headers="r3c1- | + | | headers="r3c1-t6 r1c3-t6" align="left" | |
JOIN | JOIN | ||
|} | |} | ||
Line 76: | Line 78: | ||
<br /> | <br /> | ||
− | <span id=" | + | <span id="sthref27"></span> |
''' ''' | ''' ''' | ||
Line 84: | Line 86: | ||
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. | 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=" | + | <span id="sthref28"></span> |
''' ''' | ''' ''' | ||
Line 90: | Line 92: | ||
===Examples=== | ===Examples=== | ||
− | + | The following examples show how to use this annotation with different batch fetch types. | |
− | <span id=" | + | <span id="sthref29"></span> |
− | '''''Example 2- | + | '''''Example 2-7 Using JOIN BatchFetch Type''''' |
+ | |||
+ | |||
− | <span id=" | + | <span id="sthref30"></span> |
− | '''''Example 2- | + | '''''Example 2-8 Using EXISTS BatchFetch Type''''' |
+ | |||
+ | |||
− | <span id=" | + | <span id="sthref31"></span> |
− | '''''Example 2- | + | '''''Example 2-9 Using IN BatchFetch Type''''' |
+ | |||
+ | |||
− | <span id=" | + | <span id="sthref32"></span> |
''' ''' | ''' ''' | ||
Line 118: | Line 126: | ||
For more information, see: | For more information, see: | ||
− | * [[EclipseLink/UserGuide/JPA/a_joinfetch|"@JoinFetch"]] | + | * [[EclipseLink/UserGuide/JPA/2.4/a_joinfetch|"@JoinFetch"]] |
+ | |||
+ | <span id="footerspace"> </span> | ||
---- | ---- | ||
Line 125: | Line 135: | ||
|- | |- | ||
| valign="bottom" | | | valign="bottom" | | ||
− | {| width=" | + | {| width="165" |
|- | |- | ||
| | | | ||
| align="center" | | | align="center" | | ||
− | [[EclipseLink/UserGuide/JPA/a_array| | + | [[EclipseLink/UserGuide/JPA/2.4/a_array| Previous ]]<span class="previouslink">[[Image:Elug_previous_icon.png|Previous]]</span> |
| align="center" | | | align="center" | | ||
− | [[EclipseLink/UserGuide/JPA/a_cache|Next | + | [[EclipseLink/UserGuide/JPA/2.4/a_cache| Next ]][[Image:Elug_next_icon.png|Next]] |
|} | |} | ||
| width="34%" align="center" | | | width="34%" align="center" | | ||
− | [[Image:Eclipselink-logo.gif|150px|EclispeLink]]<br />[http:// | + | [[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" | | | align="right" valign="bottom" | | ||
{| class="simple oac_no_warn" width="225" | {| class="simple oac_no_warn" width="225" | ||
| | | | ||
| align="center" valign="top" | | | align="center" valign="top" | | ||
− | [http://www.google.com/cse/home?cx=016171230611334810008:y5kxq4rqd8s&hl=en Search] | + | [[Image:Elug_Magnifier.png|Search]][http://www.google.com/cse/home?cx=016171230611334810008:y5kxq4rqd8s&hl=en Search] |
| align="center" valign="top" | | | align="center" valign="top" | | ||
− | [[EclipseLink/UserGuide/JPA/toc| Contents]] | + | [[Image:Elug_guide_icon.png|Contents]][[EclipseLink/UserGuide/JPA/2.4/toc| Contents]] |
|} | |} | ||
|} | |} |
Revision as of 14:18, 19 June 2012
|
@BatchFetch
Use @BatchFetch
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.
Annotation Elements
Table 2-3 describes this annotation's elements.
Table 2-3 @BatchFetch Annotation Elements
Annotation Element | Description | Default |
---|---|---|
size |
Default size of the batch fetch, used only when |
|
BatchFetchType |
(optional) The type of batch fetch to use:
|
JOIN |
Usage
Batch fetching allows for the optimal loading of a tree. Setting the @BatchFetch
annotation on a child relationship of a tree structure causes EclipseLink to use a single SQL statement for each level.
Examples
The following examples show how to use this annotation with different batch fetch types.
Example 2-7 Using JOIN BatchFetch Type
Example 2-8 Using EXISTS BatchFetch Type
Example 2-9 Using IN BatchFetch Type
See Also
For more information, see:
|
|
|