You can enable lazy loading at several levels. In ascending levels of precedence, these are:


Set the repository’s lazyLoadItems property to true. As installed, ATG enables lazy loading on a number of its versioned and non-versioned repositories. To verify whether a given repository uses lazy loading, check its lazyLoadItems property.

Item descriptor

Set the loadingStrategy attribute to lazy. You can set the loadingStrategy property on the item type to collect, or on the collection property that references that item type. The loadingStrategy setting of a collection property takes precedence over the referenced item type.

The following example shows how you might define the collection property categoryProducts, which references a list of product components, and sets its loadingStrategy attribute to lazy:

<property category-resource="categoryProducts" name="fixedChildProducts"
data-type="list" component-item-type="product" column-name="child_prd_id"
queryable="true" display-name-resource="fixedChildProducts">

   <attribute name="loadingStrategy" value="lazy"/>
   <attribute name="propertySortPriority" value="-4"/>
   <attribute name="references" value="true"/>

Note: If you preload an item type to a repository’s cache on startup, you must disable lazy loading for the item-type until the preload operation is complete (see Preloading Caches earlier in this chapter).


You can set the loading strategy programmatically any time after startup. The following code shows how you might use the atg.adapter.gsa.LoadingStrategyContext methods pushLoadStrategy() and popLoadStrategy(), to override and restore the current thread’s loading strategy, respectively:

try {
  LoadingStrategyContext.pushLoadStrategy("lazy");  // or set to "eager"

  // access a collection property that references other items
  List listItems =
    (List) someItem.getPropertyValue("collectionProperty");

  // or run a query
  RepositoryItem [] queryResults = rqlStatement.executeQuery(view, null);

} finally {

For full information about the LoadingStrategyContext class and all its methods, see the online ATG API Reference.

loading table of contents...