public class HibernatePrefetchHelper extends Object
Constructor and Description |
---|
HibernatePrefetchHelper(org.springframework.orm.hibernate.HibernateOperations hibernate) |
Modifier and Type | Method and Description |
---|---|
static <I,O> Collection<O> |
partitionedQuery(Collection<I> inputItems,
int partitionSize,
Function<Collection<I>,Collection<O>> query)
A convenience method for running a query against a large set of inputs.
|
<T> Collection<T> |
prefetchEntitiesById(String idPropertyName,
Collection<?> ids,
Class<T> entityType)
Attempts to efficiently load Hibernate entities of a given type given a collection od IDs.
|
public HibernatePrefetchHelper(org.springframework.orm.hibernate.HibernateOperations hibernate)
public <T> Collection<T> prefetchEntitiesById(String idPropertyName, Collection<?> ids, Class<T> entityType)
Note that if the entities are already present in the Hibernate L2 cache, then this
query will be doing unnecessary work, and the cached entities could be fetched by
Session.get(Class, Serializable)
. However, there's no way to make this
determination without getting up to our elbows in Hibernate's innards, which probably isn't worth it.
public static <I,O> Collection<O> partitionedQuery(Collection<I> inputItems, int partitionSize, Function<Collection<I>,Collection<O>> query)
Copyright © 2003–2016 Atlassian. All rights reserved.