Class FetchConfig
- All Implemented Interfaces:
Serializable
public class FetchConfig extends Object implements Serializable
// Normal fetch join results in a single SQL query
List<Order> list = DB.find(Order.class).fetch("details").findList();
Example: Using a "query join" instead of a "fetch join" we instead use 2 SQL queries
// This will use 2 SQL queries to build this object graph
List<Order> list =
DB.find(Order.class)
.fetch("details", FetchConfig.ofQuery())
.findList();
// query 1) find order
// query 2) find orderDetails where order.id in (?,?...) // first 100 order id's
- Author:
- mario, rbygrave
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description FetchConfig()
Deprecated. -
Method Summary
Modifier and Type Method Description FetchConfig
cache()
Deprecated.boolean
equals(Object o)
int
getBatchSize()
Return the batch size for fetching.int
hashCode()
boolean
isCache()
Return true if the fetch should use the L2 cache.boolean
isJoin()
Return true if the fetch should try to use SQL join.boolean
isLazy()
Return true if the fetch should be a lazy query.boolean
isQuery()
Return true if the fetch should be a eager secondary query.FetchConfig
lazy()
Deprecated.FetchConfig
lazy(int batchSize)
Deprecated.static FetchConfig
ofCache()
Return FetchConfig to eagerly fetch the relationship using L2 cache.static FetchConfig
ofDefault()
Return FetchConfig to fetch the relationship using SQL join.static FetchConfig
ofLazy()
Return FetchConfig to lazily load the relationship.static FetchConfig
ofLazy(int batchSize)
Return FetchConfig to lazily load the relationship specifying the batch size.static FetchConfig
ofQuery()
Return FetchConfig to eagerly fetch the relationship using a secondary query.static FetchConfig
ofQuery(int batchSize)
Return FetchConfig to eagerly fetch the relationship using a secondary with a given batch size.FetchConfig
query()
Deprecated.FetchConfig
query(int batchSize)
Deprecated.FetchConfig
queryFirst(int batchSize)
Deprecated.
-
Constructor Details
-
FetchConfig
Deprecated.Deprecated - migrate to one of the static factory methods likeofQuery()
Construct using default JOIN mode.
-
-
Method Details
-
ofCache
Return FetchConfig to eagerly fetch the relationship using L2 cache.Any cache misses will be loaded by secondary query to the database.
-
ofQuery
Return FetchConfig to eagerly fetch the relationship using a secondary query. -
ofQuery
Return FetchConfig to eagerly fetch the relationship using a secondary with a given batch size. -
ofLazy
Return FetchConfig to lazily load the relationship. -
ofLazy
Return FetchConfig to lazily load the relationship specifying the batch size. -
ofDefault
Return FetchConfig to fetch the relationship using SQL join. -
lazy
Deprecated.Deprecated - migrate to FetchConfig.ofLazy(). -
lazy
Deprecated.Deprecated - migrate to FetchConfig.ofLazy(batchSize). -
query
Deprecated.Deprecated - migrate to FetchConfig.ofQuery().Eagerly fetch the beans in this path as a separate query (rather than as part of the main query).
This will use the default batch size for separate query which is 100.
-
query
Deprecated.Deprecated - migrate to FetchConfig.ofQuery(batchSize).Eagerly fetch the beans in this path as a separate query (rather than as part of the main query).
The queryBatchSize is the number of parent id's that this separate query will load per batch.
This will load all beans on this path eagerly unless a
lazy(int)
is also used.- Parameters:
batchSize
- the batch size used to load beans on this path
-
queryFirst
Deprecated.Deprecated - migrate to FetchConfig.ofQuery(batchSize).Eagerly fetch the first batch of beans on this path. This is similar to
query(int)
but only fetches the first batch.If there are more parent beans than the batch size then they will not be loaded eagerly but instead use lazy loading.
- Parameters:
batchSize
- the number of parent beans this path is populated for
-
cache
Deprecated.Deprecated - migrate to FetchConfig.ofCache().Eagerly fetch the beans fetching the beans from the L2 bean cache and using the DB for beans not in the cache.
-
getBatchSize
Return the batch size for fetching. -
isCache
Return true if the fetch should use the L2 cache. -
isQuery
Return true if the fetch should be a eager secondary query. -
isLazy
Return true if the fetch should be a lazy query. -
isJoin
Return true if the fetch should try to use SQL join. -
equals
-
hashCode
-