org.hibernate.engine
Class BatchFetchQueue

java.lang.Object
  extended byorg.hibernate.engine.BatchFetchQueue

public class BatchFetchQueue
extends Object

Tracks entity and collection keys that are available for batch fetching, and the queries which were used to load entities, which can be re-used as a subquery for loading owned collections.

Author:
Gavin King

Field Summary
static Object MARKER
           
 
Constructor Summary
BatchFetchQueue(PersistenceContext context)
           
 
Method Summary
 void addBatchLoadableEntityKey(EntityKey key)
          If an EntityKey represents a batch loadable entity, add it to the queue.
 void addSubselect(EntityKey key, SubselectFetch subquery)
           
 void clear()
           
 void clearSubselects()
           
 Serializable[] getCollectionBatch(CollectionPersister collectionPersister, Serializable id, int batchSize, EntityMode entityMode)
          Get a batch of uninitialized collection keys for this role
 Serializable[] getEntityBatch(EntityPersister persister, Serializable id, int batchSize, EntityMode entityMode)
          Get a batch of unloaded identifiers for this class, using a slightly complex algorithm that tries to grab keys registered immediately after the given key.
 SubselectFetch getSubselect(EntityKey key)
           
 void removeBatchLoadableEntityKey(EntityKey key)
          After evicting or deleting or loading an entity, we don't need to batch fetch it anymore, remove it from the queue if necessary
 void removeSubselect(EntityKey key)
          After evicting or deleting an entity, we don't need to know the query that was used to load it anymore (don't call this after loading the entity, since we might still need to load its collections)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MARKER

public static final Object MARKER
Constructor Detail

BatchFetchQueue

public BatchFetchQueue(PersistenceContext context)
Method Detail

clear

public void clear()

getSubselect

public SubselectFetch getSubselect(EntityKey key)

addSubselect

public void addSubselect(EntityKey key,
                         SubselectFetch subquery)

clearSubselects

public void clearSubselects()

removeBatchLoadableEntityKey

public void removeBatchLoadableEntityKey(EntityKey key)
After evicting or deleting or loading an entity, we don't need to batch fetch it anymore, remove it from the queue if necessary


removeSubselect

public void removeSubselect(EntityKey key)
After evicting or deleting an entity, we don't need to know the query that was used to load it anymore (don't call this after loading the entity, since we might still need to load its collections)


addBatchLoadableEntityKey

public void addBatchLoadableEntityKey(EntityKey key)
If an EntityKey represents a batch loadable entity, add it to the queue.


getCollectionBatch

public Serializable[] getCollectionBatch(CollectionPersister collectionPersister,
                                         Serializable id,
                                         int batchSize,
                                         EntityMode entityMode)
Get a batch of uninitialized collection keys for this role

Parameters:
collectionPersister - the collection role
id - a key that must be included
batchSize - the maximum number of keys to return
Returns:
an array of collection keys, of length batchSize (padded with nulls)

getEntityBatch

public Serializable[] getEntityBatch(EntityPersister persister,
                                     Serializable id,
                                     int batchSize,
                                     EntityMode entityMode)
Get a batch of unloaded identifiers for this class, using a slightly complex algorithm that tries to grab keys registered immediately after the given key.

Parameters:
id - an identifier that must be included
batchSize - the maximum number of keys to return
Returns:
an array of identifiers, of length batchSize (padded with nulls)