Hi!
Let me introduce the new feature which was committed to the CVS HEAD
yesterday.
"proxy-prefetching-limit" is a new attribute that was added to the following
elements of repository.xml:
descriptor-repository
class-descriptor
reference-descriptor
collection-descriptor
The default value for "proxy-prefetching-limit" in "descriptor-repository"
is 50.
The value of "proxy-prefetching-limit" in "descriptor-repository" serves as
a defult value for "proxy-prefetching-limit" in all other elements.
Setting "proxy-prefetching-limit" to 0 disables the proxy prefetching feature.
Below we will assume that "proxy-prefetching-limit" is set to 50.
You all know such classes as Article and ProductGroup, I will use them as
example. Assume that we load the collection of Articles by some query. They
all refer to ProductGroups. Assume that we do something like this:
Collection col = pb.getCollectionByQuery(query);
for (Iterator it = col.iterator(); it.hasNext(); )
{
Article article = (Article) it.next();
doSomething(article.getProductGroup().getGroupName());
}
If Article wasn't describes with
proxy="dynamic"
and ProductGroup class wasn't describes with
proxy="org.apache.ojb.broker.ProductGroupProxy"
in repository.xml, then all Articles would be loaded by one query, and all
referred ProductGroups would be loaded by another one query due to the
recently added batch retrieval feature. But with the "proxy" attribute each
Article and each ProductGroup instance will be loaded by separate query.
Proxy prefetching mechanism adds materialization listener to the first
Article. Once article.getProductGroup() is invoked and materialization is
requested, not 1, but 51 Articles will be loaded by one query, and the
materialization listener will be moved from the 1st to the 52nd Article.
When Articles are loaded, proxies for the referred ProductGroups are created.
Again, proxy prefetching mechanism adds materialization listener to the first
ProductGroup. On the getGroupName() call for the first ProductGroup, next 50
ProductGroup instances will be prefetched together with the first one.
Similarly for CollectionProxies.
Regards,
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]