Top Description Fields Constructors Methods
org.eclipse.persistence.queries

public Class BatchFetchPolicy

extends Object
implements Serializable, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, java.io.Serializable
Imports
java.io.Serializable, java.util.ArrayList, .HashMap, .List, .Map, org.eclipse.persistence.annotations.BatchFetchType, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.expressions.Expression, org.eclipse.persistence.internal.expressions.QueryKeyExpression, org.eclipse.persistence.internal.sessions.AbstractRecord, org.eclipse.persistence.mappings.DatabaseMapping

BatchFetchPolicy defines batch reading configuration.
Author
James Sutherland
See Also
org.eclipse.persistence.queries.ObjectLevelReadQuery#setBatchFetchPolicy(BatchFetchPolicy)

Field Summary

Modifier and TypeField and Description
protected List<Expression>
attributeExpressions

Define the attributes to be batch fetched.

protected List<String>
attributes

PERF: Cache the local batch read attribute names.

protected List<DatabaseMapping>
batchedMappings

Define the mapping to be batch fetched (from mapping settings).

protected transient Map<Object, Object>
batchObjects

Stores temporary map of batched objects (this queries results).

protected transient Map<Object, List<AbstractRecord>>
dataResults

Stores temporary list of rows from parent batch query per batched mapping.

protected transient Map<DatabaseMapping, ReadQuery>
mappingQueries

PERF: Used internally to store the prepared mapping queries.

protected int
size

Define the batch size for IN style batch fetching.

protected BatchFetchType
type

Define the type of batch fetching to use.

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public void
addDataResults(AbstractRecord row)

INTERNAL: Add the row to the set of data results.

public BatchFetchPolicy
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.
public List<AbstractRecord>
getAllDataResults()

INTERNAL: Return temporary list of rows from parent batch query per batched mapping.

public List<Expression>
getAttributeExpressions()

INTERNAL: Return all attributes specified for batch reading.

public List<String>
getAttributes()

INTERNAL: PERF: Return the cached local (only) batch read attribute names.

public List<DatabaseMapping>
getBatchedMappings()

INTERNAL: Return any mappings that are always batched.

public Map<Object, Object>
getBatchObjects()

INTERNAL: Return temporary map of batched objects.

public List<AbstractRecord>
getDataResults(DatabaseMapping mapping)

INTERNAL: Return the remaining data results for the mapping.

public Map<Object, List<AbstractRecord>>
getDataResults()

INTERNAL: Return temporary list of rows from parent batch query per batched mapping.

public Map<DatabaseMapping, ReadQuery>
getMappingQueries()

INTERNAL: PERF: Return the internally stored prepared mapping queries.

public int
getSize()

Return the batch fetch size.

public BatchFetchType
getType()

Return the batch fetch type, (JOIN, IN, EXISTS).

public boolean
hasAttributes()

INTERNAL: Return true is this query has batching

public boolean
isAttributeBatchRead(String attributeName)

INTERNAL: Return if the attribute is specified for batch reading.

public boolean
isAttributeBatchRead(ClassDescriptor mappingDescriptor, String attributeName)

INTERNAL: Return if the attribute is specified for batch reading.

public boolean
isEXISTS()

Return if using the EXISTS fetch type.

public boolean
isIN()

Return if using the IN fetch type.

public boolean
isJOIN()

Return if using the JOIN fetch type.

public void
setAttributeExpressions(List<Expression> attributeExpressions)

public void
setAttributes(List<String> attributes)

INTERNAL: PERF: Set the cached local (only) batch read attribute names.

public void
setBatchedMappings(List<DatabaseMapping> batchedMappings)

INTERNAL: Set any mappings that are always batched.

public void
setBatchObjects(Map<Object, Object> batchObjects)

INTERNAL: Set temporary map of batched objects.

public void
setDataResults(DatabaseMapping mapping, List<AbstractRecord> rows)

INTERNAL: Set the remaining data results for the mapping.

public void
setDataResults(List<AbstractRecord> rows)

INTERNAL: Set the rows to the set of data results for each mapping.

public void
setDataResults(Map<Object, List<AbstractRecord>> dataResults)

INTERNAL: Set temporary list of rows from parent batch query per batched mapping.

public void
setMappingQueries(Map<DatabaseMapping, ReadQuery> mappingQueries)

INTERNAL: PERF: Set the internally stored prepared mapping queries.

public void
setSize(int size)

Set the batch fetch size.

public void
setType(BatchFetchType type)

Set the batch fetch type, (JOIN, IN, EXISTS).

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeExpressionsback to summary
protected List<Expression> attributeExpressions

Define the attributes to be batch fetched.

attributesback to summary
protected List<String> attributes

PERF: Cache the local batch read attribute names.

batchedMappingsback to summary
protected List<DatabaseMapping> batchedMappings

Define the mapping to be batch fetched (from mapping settings).

batchObjectsback to summary
protected transient Map<Object, Object> batchObjects

Stores temporary map of batched objects (this queries results).

dataResultsback to summary
protected transient Map<Object, List<AbstractRecord>> dataResults

Stores temporary list of rows from parent batch query per batched mapping.

mappingQueriesback to summary
protected transient Map<DatabaseMapping, ReadQuery> mappingQueries

PERF: Used internally to store the prepared mapping queries.

sizeback to summary
protected int size

Define the batch size for IN style batch fetching.

typeback to summary
protected BatchFetchType type

Define the type of batch fetching to use.

Constructor Detail

BatchFetchPolicyback to summary
public BatchFetchPolicy()
BatchFetchPolicyback to summary
public BatchFetchPolicy(BatchFetchType type)

Method Detail

addDataResultsback to summary
public void addDataResults(AbstractRecord row)

INTERNAL: Add the row to the set of data results. This is used for IN batching in batches.

cloneback to summary
public BatchFetchPolicy clone()

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:BatchFetchPolicy

a clone of this instance.

Annotations
@Override
getAllDataResultsback to summary
public List<AbstractRecord> getAllDataResults()

INTERNAL: Return temporary list of rows from parent batch query per batched mapping. This is used for IN batching in batches.

getAttributeExpressionsback to summary
public List<Expression> getAttributeExpressions()

INTERNAL: Return all attributes specified for batch reading.

getAttributesback to summary
public List<String> getAttributes()

INTERNAL: PERF: Return the cached local (only) batch read attribute names.

getBatchedMappingsback to summary
public List<DatabaseMapping> getBatchedMappings()

INTERNAL: Return any mappings that are always batched.

getBatchObjectsback to summary
public Map<Object, Object> getBatchObjects()

INTERNAL: Return temporary map of batched objects.

getDataResultsback to summary
public List<AbstractRecord> getDataResults(DatabaseMapping mapping)

INTERNAL: Return the remaining data results for the mapping. This is used for IN batching in batches.

getDataResultsback to summary
public Map<Object, List<AbstractRecord>> getDataResults()

INTERNAL: Return temporary list of rows from parent batch query per batched mapping. This is used for IN batching in batches.

getMappingQueriesback to summary
public Map<DatabaseMapping, ReadQuery> getMappingQueries()

INTERNAL: PERF: Return the internally stored prepared mapping queries.

getSizeback to summary
public int getSize()

Return the batch fetch size.

getTypeback to summary
public BatchFetchType getType()

Return the batch fetch type, (JOIN, IN, EXISTS).

hasAttributesback to summary
public boolean hasAttributes()

INTERNAL: Return true is this query has batching

isAttributeBatchReadback to summary
public boolean isAttributeBatchRead(String attributeName)

INTERNAL: Return if the attribute is specified for batch reading.

isAttributeBatchReadback to summary
public boolean isAttributeBatchRead(ClassDescriptor mappingDescriptor, String attributeName)

INTERNAL: Return if the attribute is specified for batch reading.

isEXISTSback to summary
public boolean isEXISTS()

Return if using the EXISTS fetch type.

isINback to summary
public boolean isIN()

Return if using the IN fetch type.

isJOINback to summary
public boolean isJOIN()

Return if using the JOIN fetch type.

setAttributeExpressionsback to summary
public void setAttributeExpressions(List<Expression> attributeExpressions)
setAttributesback to summary
public void setAttributes(List<String> attributes)

INTERNAL: PERF: Set the cached local (only) batch read attribute names.

setBatchedMappingsback to summary
public void setBatchedMappings(List<DatabaseMapping> batchedMappings)

INTERNAL: Set any mappings that are always batched.

setBatchObjectsback to summary
public void setBatchObjects(Map<Object, Object> batchObjects)

INTERNAL: Set temporary map of batched objects.

setDataResultsback to summary
public void setDataResults(DatabaseMapping mapping, List<AbstractRecord> rows)

INTERNAL: Set the remaining data results for the mapping. This is used for IN batching in batches.

setDataResultsback to summary
public void setDataResults(List<AbstractRecord> rows)

INTERNAL: Set the rows to the set of data results for each mapping. This is used for IN batching in batches.

setDataResultsback to summary
public void setDataResults(Map<Object, List<AbstractRecord>> dataResults)

INTERNAL: Set temporary list of rows from parent batch query per batched mapping. This is used for IN batching in batches.

setMappingQueriesback to summary
public void setMappingQueries(Map<DatabaseMapping, ReadQuery> mappingQueries)

INTERNAL: PERF: Set the internally stored prepared mapping queries.

setSizeback to summary
public void setSize(int size)

Set the batch fetch size.

setTypeback to summary
public void setType(BatchFetchType type)

Set the batch fetch type, (JOIN, IN, EXISTS).