Package io.ebean.annotation
Annotation Type FetchPreference
-
@Retention(RUNTIME) @Target(FIELD) public @interface FetchPreference
Used to control which ToMany relationships are preferred as 'joins' rather than as 'secondary joins' (query fetches).Ebean automatically limits the number of SQL joins to ToMany relationships to avoid SQL cartesian product and to honor SQL first row / max rows limits. It does this by allowing the first ToMany relationship/path that has been defined on a query to be included in the main query as a join and then converting any remaining ToMany relationship/path to "query joins".
Without explicit use of
@FetchPreferencethe first path that contains a ToMany is included in the main query as a join.Indicate to Ebean the preferred relationships to join to.
Example
Prefer joins to 'participants' over 'messages'
{@code
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description intvalueThe fetch preference used - low value means higher preference.
-
-
-
Element Detail
-
value
int value
The fetch preference used - low value means higher preference.
-
-