EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference

org.eclipse.persistence.queries
Class FetchGroup

java.lang.Object
  extended by org.eclipse.persistence.queries.FetchGroup
All Implemented Interfaces:
java.io.Serializable

public class FetchGroup
extends java.lang.Object
implements java.io.Serializable

Purpose: A fetch group is a performance enhancement that allows a group of attributes of an object to be loaded on demand, which means that the data for an attribute might not loaded from the underlying data source until an explicit access call for the attribute first occurs. It avoids the wasteful practice of loading up all data of the object's attributes, in which the user is interested in only partial of them.

A great deal of caution and careful system use case analysis should be use when using the fetch group feature, as the extra round-trip would well offset the gain from the deferred loading in many cases.

EclipseLink fetch group support is twofold: the pre-defined fetch groups at the descriptor level; and dynamic (use case) fetch groups at the query level.

Every query can has at most one fetch group. There is an optional pre-defined default fetch group at the descriptor level. If set, and the query has no fetch group being set, the default fetch group would be used, unless query.setShouldUseDefaultFetchGroup(false) is also called. In the latter case, the full object will be fetched after the query execution.

See Also:
FetchGroup, FetchGroupTracker, Serialized Form
Author:
King Wang
Since:
TopLink 10.1.3.

Constructor Summary
FetchGroup()
          Constructor.
FetchGroup(java.lang.String name)
          Constructor with a group name.
 
Method Summary
 void addAttribute(java.lang.String attrName)
          Add an attribute to the group.
 void addAttributes(java.util.Collection newAttributes)
          Add a set of attributes to the group.
 boolean containsAttribute(java.lang.String attribute)
          Return if the attribute is defined in the group.
 java.util.Set getAttributes()
          Return attributes defined in the group.
 java.lang.String getName()
          Return the group name.
 boolean isSupersetOf(FetchGroup anotherGroup)
          INTERNAL: Return true if this fetch group is a super-set of the passed in fetch group.
 void removeAttribute(java.lang.String attrName)
          Remove an attribute from the group.
 void setName(java.lang.String name)
          Set the group name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FetchGroup

public FetchGroup()
Constructor.


FetchGroup

public FetchGroup(java.lang.String name)
Constructor with a group name.

Method Detail

containsAttribute

public boolean containsAttribute(java.lang.String attribute)
Return if the attribute is defined in the group.


getAttributes

public java.util.Set getAttributes()
Return attributes defined in the group.


addAttribute

public void addAttribute(java.lang.String attrName)
Add an attribute to the group.


addAttributes

public void addAttributes(java.util.Collection newAttributes)
Add a set of attributes to the group.


removeAttribute

public void removeAttribute(java.lang.String attrName)
Remove an attribute from the group.


getName

public java.lang.String getName()
Return the group name.


setName

public void setName(java.lang.String name)
Set the group name.


isSupersetOf

public boolean isSupersetOf(FetchGroup anotherGroup)
INTERNAL: Return true if this fetch group is a super-set of the passed in fetch group.


EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference