Package ubic.gemma.persistence.util
Class QueryUtils
- java.lang.Object
- 
- ubic.gemma.persistence.util.QueryUtils
 
- 
- 
Field SummaryFields Modifier and Type Field Description static intMAX_PARAMETER_LIST_SIZELargest parameter list size for whichoptimizeParameterList(Collection)should be used.
 - 
Constructor SummaryConstructors Constructor Description QueryUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Identifiable>
 List<List<T>>batchIdentifiableParameterList(Collection<T> list, int batchSize)static <T extends Comparable<T>>
 List<List<T>>batchParameterList(Collection<T> list, int batchSize)Partition a parameter list into a collection of batches of a given size.static StringescapeLike(String s)static <S extends Comparable<S>,T>
 List<T>listByBatch(Query query, String batchParam, Collection<S> list, int batchSize)static <S extends Comparable<S>,T>
 List<T>listByBatch(Query query, String batchParam, Collection<S> list, int batchSize, int maxResults)List the results of a query by a fixed batch size.static <T extends Identifiable>
 Collection<T>optimizeIdentifiableParameterList(Collection<T> list)Optimize a collection ofIdentifiableentities.static <T extends Comparable<T>>
 Collection<T>optimizeParameterList(Collection<T> list)Optimize a given parameter list by sorting, removing duplicates and padding to the next power of two.static <S extends Comparable<S>,T>
 Stream<T>streamByBatch(Query query, String batchParam, Collection<S> list, int batchSize)Stream the results of a query by a fixed batch size.static <S extends Comparable<S>,T>
 Stream<T>streamByBatch(Query query, String batchParam, Collection<S> list, int batchSize, Class<T> clazz)
 
- 
- 
- 
Field Detail- 
MAX_PARAMETER_LIST_SIZEpublic static final int MAX_PARAMETER_LIST_SIZE Largest parameter list size for whichoptimizeParameterList(Collection)should be used. Past this size, no padding will be performed and a warning will be emitted.- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
optimizeParameterListpublic static <T extends Comparable<T>> Collection<T> optimizeParameterList(Collection<T> list) Optimize a given parameter list by sorting, removing duplicates and padding to the next power of two.This is a temporary solution until we update to Hibernate 5.2.18 which introduced hibernate.query.in_clause_parameter_padding. Read more about this topic.
 - 
optimizeIdentifiableParameterListpublic static <T extends Identifiable> Collection<T> optimizeIdentifiableParameterList(Collection<T> list) Optimize a collection ofIdentifiableentities.- See Also:
- optimizeParameterList(Collection)
 
 - 
batchParameterListpublic static <T extends Comparable<T>> List<List<T>> batchParameterList(Collection<T> list, int batchSize) Partition a parameter list into a collection of batches of a given size.It is recommended to use a power of two in case the same query is also prepared via optimizeParameterList(Collection). This will make it so that the execution plan can be reused.
 - 
batchIdentifiableParameterListpublic static <T extends Identifiable> List<List<T>> batchIdentifiableParameterList(Collection<T> list, int batchSize) 
 - 
listByBatchpublic static <S extends Comparable<S>,T> List<T> listByBatch(Query query, String batchParam, Collection<S> list, int batchSize) 
 - 
listByBatchpublic static <S extends Comparable<S>,T> List<T> listByBatch(Query query, String batchParam, Collection<S> list, int batchSize, int maxResults) List the results of a query by a fixed batch size.- Parameters:
- query- the query
- batchParam- a parameter of the query for batching
- list- a collection of values for the batch parameters to retrieve
- batchSize- the number of elements to fetch in each batch
- maxResults- maximum number of results to return, or -1 to ignore
 
 - 
streamByBatchpublic static <S extends Comparable<S>,T> Stream<T> streamByBatch(Query query, String batchParam, Collection<S> list, int batchSize, Class<T> clazz) 
 - 
streamByBatchpublic static <S extends Comparable<S>,T> Stream<T> streamByBatch(Query query, String batchParam, Collection<S> list, int batchSize) Stream the results of a query by a fixed batch size.
 
- 
 
-