arminw
Thu, 02 Aug 2007 08:36:59 -0700
Author: arminw Date: Thu Aug 2 08:36:32 2007 New Revision: 562139 URL: http://svn.apache.org/viewvc?view=rev&rev=562139 Log: rename prefetching mode method Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java?view=diff&rev=562139&r1=562138&r2=562139 ============================================================================== --- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java (original) +++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java Thu Aug 2 08:36:32 2007 @@ -38,7 +38,6 @@ import org.apache.ojb.broker.core.proxy.IndirectionHandler; import org.apache.ojb.broker.core.proxy.MaterializationListener; import org.apache.ojb.broker.metadata.ClassDescriptor; -import org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException; import org.apache.ojb.broker.metadata.CollectionDescriptor; import org.apache.ojb.broker.metadata.FieldDescriptor; import org.apache.ojb.broker.metadata.FieldHelper; @@ -68,7 +67,7 @@ private PersistenceBrokerImpl pb; private HashMap m_retrievalTasks; private ArrayList prefetchingListeners; - private boolean prefetchProxies = true; + private boolean autoPrefetch = true; private Class classToPrefetch; private PBLifeCycleEvent afterLookupEvent; @@ -79,21 +78,21 @@ } /** - * Return <em>true</em> if proxy object reference pre-fetching is enabled, + * Return <em>true</em> if object reference prefetching is enabled, * <em>false</em> if disabled. */ - public boolean isPrefetchProxies() + public boolean isAutoPrefetch() { - return prefetchProxies; + return autoPrefetch; } /** - * Enable or disable proxy object reference pre-fetching. By default it's enabled. - * @param prefetchProxies If set <em>true</em>, reference pre-fetching will be enabled. + * Enable or disable object reference prefetching. By default it's enabled. + * @param autoPrefetch If set <em>true</em>, reference prefetching will be enabled. */ - public void setPrefetchProxies(boolean prefetchProxies) + public void setAutoPrefetch(boolean autoPrefetch) { - this.prefetchProxies = prefetchProxies; + this.autoPrefetch = autoPrefetch; } /** @@ -103,11 +102,11 @@ * @param query the query */ private ManageableCollection getCollectionByQuery(Class collectionClass, Class itemClass, Query query) - throws ClassNotPersistenceCapableException, PersistenceBrokerException + throws PersistenceBrokerException { if (log.isDebugEnabled()) log.debug("getCollectionByQuery (" + collectionClass + ", " + itemClass + ", " + query + ")"); - ClassDescriptor cld = pb.getClassDescriptor(itemClass); + ManageableCollection result = null; OJBIterator iter = null; int fullSize = -1; @@ -125,13 +124,13 @@ try { result = (ManageableCollection) ClassHelper.newInstance(collectionClass); - + ClassDescriptor cld = pb.getClassDescriptor(itemClass); // now iterate over all elements and add them to the new collection // lifecycle events are disabled iter = pb.getIteratorFromQuery(query, cld); iter.disableLifeCycleEvents(); - // BRJ : get fullSizefor Query + // BRJ : get fullSize for Query // to be removed when Query.fullSize is removed if (iter instanceof PagingIterator) { @@ -170,7 +169,7 @@ + SystemUtils.LINE_SEPARATOR +"'declared' extent in "+itemClass + "." + " This can cause side-effects and will NOT INCLUDED in the current generated collection result"); } - if (prefetchProxies && (handler != null) + if (autoPrefetch && (handler != null) && (cld.getProxyPrefetchingLimit() > 0) && addRetrievalTask(candidate, this)) { @@ -403,7 +402,7 @@ refField = rds.getPersistentField(); refField.set(obj, refObj); - if ((refObj != null) && prefetchProxies && (m_retrievalTasks != null) + if ((refObj != null) && autoPrefetch && (m_retrievalTasks != null) && (rds.getProxyPrefetchingLimit() > 0)) { IndirectionHandler handler = pb.getProxyFactory().getIndirectionHandler(refObj); @@ -451,7 +450,7 @@ refField = rds.getPersistentField(); refField.set(obj, refObj); - if ((refObj != null) && prefetchProxies && (m_retrievalTasks != null) + if ((refObj != null) && autoPrefetch && (m_retrievalTasks != null) && (rds.getProxyPrefetchingLimit() > 0)) { IndirectionHandler handler = pb.getProxyFactory().getIndirectionHandler(refObj); @@ -751,7 +750,7 @@ collectionField.set(obj, value); - if (prefetchProxies && (m_retrievalTasks != null) + if (autoPrefetch && (m_retrievalTasks != null) && (cds.getProxyPrefetchingLimit() > 0) && (cds.getQueryCustomizer() == null) && (pb.getProxyFactory().isCollectionProxy(value))) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]