public class ByHqlStatic extends Object implements HqlQuery
| Modifier and Type | Method and Description |
|---|---|
ByHqlStatic |
assignBatchPreExecuteUpdateQuery(String theBatchPreExecuteUpdateQuery)
if batch deleting, run this execute update first.
|
ByHqlStatic |
assignConvertHqlColumnsToObject(boolean theConvert)
if use resulttransformer to change columns to object
|
ByHqlStatic |
createQuery(String theHqlQuery)
set the query to run
|
long |
deleteInBatches(Class<?> idType,
String hqlClassNameToDelete,
String columnNameOfId)
GRP-1439: remove records with a max number and loop so it doesnt fail
select ids in batches of 10k delete records in batches of 100
Note this should be setup to select a list of scalar String ids.
|
void |
executeUpdate()
call hql executeUpdate, e.g.
|
int |
executeUpdateInt()
call hql executeUpdate, e.g.
|
<R> List<R> |
list(Class<R> returnType)
call hql list result
e.g.
|
<K,V> Map<K,V> |
listMap(Class<K> keyClass,
Class<V> valueClass,
String keyPropertyName)
call hql list result, and put the results in map with the key as one of the fields
|
<S> Set<S> |
listSet(Class<S> returnType)
call hql list result, and put the results in an ordered set
e.g.
|
ByHqlStatic |
options(QueryOptions queryOptions1)
add a paging/sorting/resultSetSize, etc to the query
|
ByHqlStatic |
setCacheable(Boolean cacheable)
assign if this query is cacheable or not.
|
ByHqlStatic |
setCacheRegion(String cacheRegion)
cache region for cache
|
ByHqlStatic |
setCollectionInClause(StringBuilder query,
Collection<?> params)
append a certain number of params, and commas, and attach
the data.
|
ByHqlStatic |
setDouble(String bindVarName,
Double value)
assign data to the bind var
|
ByHqlStatic |
setGrouperTransactionType(GrouperTransactionType theGrouperTransactionType)
assign a different grouperTransactionType (e.g.
|
ByHqlStatic |
setInteger(String bindVarName,
Integer value)
assign data to the bind var
|
ByHqlStatic |
setLong(String bindVarName,
Long value)
assign data to the bind var
|
ByHqlStatic |
setScalar(String bindVarName,
Object value)
assign data to the bind var
|
ByHqlStatic |
setString(String bindVarName,
String value)
assign data to the bind var
|
ByHqlStatic |
setTimestamp(String bindVarName,
Date value)
assign data to the bind var
|
String |
toString()
string value for error handling
|
<Q> Q |
uniqueResult(Class<Q> returnType)
call hql unique result (returns one or null)
e.g.
|
public ByHqlStatic assignConvertHqlColumnsToObject(boolean theConvert)
theConvert - public ByHqlStatic setGrouperTransactionType(GrouperTransactionType theGrouperTransactionType)
theGrouperTransactionType - public ByHqlStatic setCacheable(Boolean cacheable)
cacheable - the cacheable to setpublic String toString()
public ByHqlStatic assignBatchPreExecuteUpdateQuery(String theBatchPreExecuteUpdateQuery)
theBatchPreExecuteUpdateQuery - public ByHqlStatic createQuery(String theHqlQuery)
theHqlQuery - public ByHqlStatic setCacheRegion(String cacheRegion)
cacheRegion - the cacheRegion to setpublic ByHqlStatic setString(String bindVarName, String value)
public ByHqlStatic setTimestamp(String bindVarName, Date value)
bindVarName - value - public ByHqlStatic setLong(String bindVarName, Long value)
bindVarName - value - is long, primitive so not nullpublic ByHqlStatic setDouble(String bindVarName, Double value)
bindVarName - value - is doublepublic ByHqlStatic setInteger(String bindVarName, Integer value)
bindVarName - value - is long, primitive so not nullpublic ByHqlStatic setScalar(String bindVarName, Object value)
public ByHqlStatic setCollectionInClause(StringBuilder query, Collection<?> params)
query - params - collection of params, note, this is for an inclause, so it cant be nullpublic <Q> Q uniqueResult(Class<Q> returnType) throws GrouperDAOException
call hql unique result (returns one or null)
e.g.
Hib3GroupDAO hib3GroupDAO = HibernateSession.byHqlStatic()
.createQuery("from Hib3GroupDAO as g where g.uuid = :uuid")
.setCacheable(false)
.setCacheRegion(KLASS + ".Exists")
.setString("uuid", uuid).uniqueResult(Hib3GroupDAO.class);
Q - is the templatereturnType - type of the result (in future can use this for typecasting)GrouperDAOExceptionpublic <R> List<R> list(Class<R> returnType) throws GrouperDAOException
call hql list result e.g. Listhib3GroupTypeTupleDAOs = HibernateSession.byHqlStatic() .createQuery("from Hib3GroupTypeTupleDAO as gtt where gtt.groupUuid = :group") .setCacheable(false).setString("group", uuid).list(Hib3GroupTypeTupleDAO.class);
R - is the templatereturnType - type of the result (can typecast)GrouperDAOExceptionpublic <S> Set<S> listSet(Class<S> returnType) throws GrouperDAOException
call hql list result, and put the results in an ordered set e.g. SetgroupTypeTupleDTOs = HibernateSession.byHqlStatic() .createQuery("from Hib3GroupTypeTupleDAO as gtt where gtt.groupUuid = :group") .setCacheable(false).setString("group", uuid).listSet(Hib3GroupTypeTupleDAO.class);
S - is the templatereturnType - type of the result (can typecast)GrouperDAOExceptionpublic <K,V> Map<K,V> listMap(Class<K> keyClass, Class<V> valueClass, String keyPropertyName) throws GrouperDAOException
call hql list result, and put the results in map with the key as one of the fields
K - is the template of the key of the mapV - is the template of the value of the mapvalueClass - type of the result (can typecast)keyClass - is the type of the key of the mapkeyPropertyName - name of the javabeans property for the key in the mapGrouperDAOExceptionpublic long deleteInBatches(Class<?> idType, String hqlClassNameToDelete, String columnNameOfId)
idType - type of id which can be String or longhqlClassNameToDelete - columnNameOfId - public void executeUpdate()
throws GrouperDAOException
call hql executeUpdate, e.g. delete or update statement
GrouperDAOException - TODO remove this in a new version of Grouperpublic int executeUpdateInt()
throws GrouperDAOException
call hql executeUpdate, e.g. delete or update statement
GrouperDAOExceptionpublic ByHqlStatic options(QueryOptions queryOptions1)
queryOptions1 - Copyright © 2016 Internet2. All rights reserved.