org.apache.ojb.broker.accesslayer
Class MtoNCollectionPrefetcher

java.lang.Object
  extended byorg.apache.ojb.broker.accesslayer.BasePrefetcher
      extended byorg.apache.ojb.broker.accesslayer.RelationshipPrefetcherImpl
          extended byorg.apache.ojb.broker.accesslayer.CollectionPrefetcher
              extended byorg.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher
All Implemented Interfaces:
RelationshipPrefetcher

public class MtoNCollectionPrefetcher
extends CollectionPrefetcher

Relationship Prefetcher for MtoN-Collections.

Version:
$Id: MtoNCollectionPrefetcher.java,v 1.5 2004/02/06 20:49:21 brj Exp $
Author:
Jakob Braeuchi

Field Summary
 
Fields inherited from class org.apache.ojb.broker.accesslayer.BasePrefetcher
IN_LIMIT, itemClassDesc, pkLimit
 
Constructor Summary
MtoNCollectionPrefetcher(PersistenceBroker aBroker, ObjectReferenceDescriptor anOrd)
           
 
Method Summary
protected  void associateBatched(java.util.Collection owners, java.util.Collection children, java.util.Collection mToNImplementors)
          associate the batched Children with their owner object loop over children
protected  Query[] buildMtoNImplementorQueries(java.util.Collection owners, java.util.Collection children)
          Build the multiple queries for one relationship because of limitation of IN(...)
protected  Query buildMtoNImplementorQuery(java.util.Collection ids)
          Build a query to read the mn-implementors
protected  Query buildPrefetchQuery(java.util.Collection ids)
          Build the prefetch query for a M-N relationship, The query looks like the following sample :
 void prefetchRelationship(java.util.Collection owners)
          Prefetch the Relationship for the owners (the 1 side of a 1:n)
 
Methods inherited from class org.apache.ojb.broker.accesslayer.CollectionPrefetcher
associateBatched, buildPrefetchQueries, createCollection, getCollectionDescriptor
 
Methods inherited from class org.apache.ojb.broker.accesslayer.RelationshipPrefetcherImpl
getObjectReferenceDescriptor, getOwnerClassDescriptor, isCascadeRetrieve, prepareRelationshipSettings, restoreRelationshipSettings, setCascadeRetrieve, setObjectReferenceDescriptor
 
Methods inherited from class org.apache.ojb.broker.accesslayer.BasePrefetcher
buildPrefetchCriteria, buildPrefetchQuery, buildPrefetchQuery, getBroker, getDescriptorRepository, getItemClassDescriptor, getLimit, getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MtoNCollectionPrefetcher

public MtoNCollectionPrefetcher(PersistenceBroker aBroker,
                                ObjectReferenceDescriptor anOrd)
Parameters:
aBroker -
anOrd -
Method Detail

prefetchRelationship

public void prefetchRelationship(java.util.Collection owners)
Description copied from interface: RelationshipPrefetcher
Prefetch the Relationship for the owners (the 1 side of a 1:n)

Specified by:
prefetchRelationship in interface RelationshipPrefetcher
Overrides:
prefetchRelationship in class BasePrefetcher
See Also:
RelationshipPrefetcher.prefetchRelationship(Collection)

buildPrefetchQuery

protected Query buildPrefetchQuery(java.util.Collection ids)
Build the prefetch query for a M-N relationship, The query looks like the following sample :
       crit = new Criteria(); 
       crit.addIn("PERSON_PROJECT.PROJECT_ID", ids); 
       crit.addEqualToField("id","PERSON_PROJECT.PERSON_ID"); 
       qry = new QueryByMtoNCriteria(Person.class, "PERSON_PROJECT", crit, true);
 

Overrides:
buildPrefetchQuery in class CollectionPrefetcher
Parameters:
ids - Collection containing all identities of objects of the M side
Returns:

buildMtoNImplementorQuery

protected Query buildMtoNImplementorQuery(java.util.Collection ids)
Build a query to read the mn-implementors

Parameters:
ids -
Returns:

buildMtoNImplementorQueries

protected Query[] buildMtoNImplementorQueries(java.util.Collection owners,
                                              java.util.Collection children)
Build the multiple queries for one relationship because of limitation of IN(...)

Parameters:
owners - Collection containing all objects of the ONE side

associateBatched

protected void associateBatched(java.util.Collection owners,
                                java.util.Collection children,
                                java.util.Collection mToNImplementors)
associate the batched Children with their owner object loop over children



Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14