com.atlassian.crowd.util.persistence.hibernate.batch
Class AbstractBatchFinder
java.lang.Object
com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchFinder
- All Implemented Interfaces:
- BatchFinder
public abstract class AbstractBatchFinder
- extends java.lang.Object
- implements BatchFinder
Abstract implementation of the batch finder, sub classes should extend this implementation with an implementation
of processBatchFind(long, java.util.Collection, Class) which performs the hibernate version specific
search.
Callback methods beforeFind() and afterFind() can be used to wrap the search in a session
and/or transaction.
|
Method Summary |
protected void |
afterFind()
|
protected void |
beforeFind()
|
<E extends java.io.Serializable>
java.util.Collection<E> |
|
find(long directoryID,
java.util.Collection<java.lang.String> names,
java.lang.Class<E> persistentClass)
Returns a collection of entities that match the
names provided. |
protected abstract
<E> java.util.Collection<E> |
|
processBatchFind(long directoryID,
java.util.Collection<java.lang.String> names,
java.lang.Class<E> persistentClass)
|
void |
setBatchSize(int batchSize)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractBatchFinder
public AbstractBatchFinder()
setBatchSize
public void setBatchSize(int batchSize)
find
public <E extends java.io.Serializable> java.util.Collection<E> find(long directoryID,
java.util.Collection<java.lang.String> names,
java.lang.Class<E> persistentClass)
- Returns a collection of entities that match the
names provided. Any names that cannot be matched
to persistent entities are not present in the resultant
collection.
Internally, this performs a:
SELECT * FROM entityTable WHERE entityName IN (...)
This is batched such that the size of the IN
clause is at most the batchSize.
- Specified by:
find in interface BatchFinder
- Parameters:
directoryID - directory ID of the entities to return.names - collection of entity names. This, along with the directoryID
should form the primary key of the entity.persistentClass - the persistent class to lookup. This must
be a Hibernate-mapped DirectoryEntity.
- Returns:
- a collection of the DirectoryEntities that exist
matching any of the supplied names.
beforeFind
protected void beforeFind()
afterFind
protected void afterFind()
processBatchFind
protected abstract <E> java.util.Collection<E> processBatchFind(long directoryID,
java.util.Collection<java.lang.String> names,
java.lang.Class<E> persistentClass)
Copyright © 2012 Atlassian. All Rights Reserved.