public class ByHql extends Object implements HqlQuery
Modifier and Type | Field and Description |
---|---|
static int |
queryCountQueries
query count exec queries, used for testing
|
Constructor and Description |
---|
ByHql(HibernateSession theHibernateSession) |
Modifier and Type | Method and Description |
---|---|
protected void |
copyFieldsTo(edu.internet2.middleware.grouper.hibernate.ByQueryBase byQueryBase)
copy fields from this to the argument
|
ByHql |
createQuery(String theHqlQuery)
set the query to run
|
void |
executeUpdate()
call hql executeUpdate, e.g.
|
int |
executeUpdateInt()
call hql executeUpdate, e.g.
|
protected HibernateSession |
getHibernateSession() |
boolean |
isIgnoreHooks()
if we should ignore hooks
|
<T> List<T> |
list(Class<T> 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.
|
static void |
main(String[] args) |
ByHql |
options(QueryOptions queryOptions1)
add a paging/sorting/resultSetSize, etc to the query
|
protected edu.internet2.middleware.grouper.hibernate.ByQueryBase |
set(HibernateSession theHibernateSession2)
set the hibernate session to re-use, or null for a new one
byCriteriaStatic().set(hibernateSession2).select(...)
|
ByHql |
setCacheable(Boolean cacheable)
assign if this query is cacheable or not.
|
ByHql |
setCacheRegion(String cacheRegion)
cache region for cache
|
ByHql |
setCollectionInClause(StringBuilder query,
Collection<?> params)
append a certain number of params, and commas, and attach
the data.
|
void |
setConvertHqlColumnsToObject(boolean theConvertHqlColumnsToObject)
if use resulttransformer to change columns to object
|
ByHql |
setDouble(String bindVarName,
Double value)
assign data to the bind var
|
ByHql |
setGrouperTransactionType(GrouperTransactionType theGrouperTransactionType)
assign a different grouperTransactionType (e.g.
|
edu.internet2.middleware.grouper.hibernate.ByQueryBase |
setIgnoreHooks(boolean theIgnoreHooks)
if we should ignore hooks
|
ByHql |
setInteger(String bindVarName,
Integer value)
assign data to the bind var
|
ByHql |
setLong(String bindVarName,
Long value)
assign data to the bind var
|
ByHql |
setScalar(String bindVarName,
Object value)
assign data to the bind var
|
ByHql |
setString(String bindVarName,
String value)
assign data to the bind var
|
ByHql |
setTimestamp(String bindVarName,
Date value)
assign data to the bind var
|
String |
toString()
string value for error handling
|
<T> T |
uniqueResult(Class<T> returnType)
call hql unique result (returns one or null)
e.g.
|
public static int queryCountQueries
public ByHql(HibernateSession theHibernateSession)
theHibernateSession
- public void setConvertHqlColumnsToObject(boolean theConvertHqlColumnsToObject)
theConvertHqlColumnsToObject
- public ByHql setTimestamp(String bindVarName, Date value)
bindVarName
- value
- public ByHql setGrouperTransactionType(GrouperTransactionType theGrouperTransactionType)
theGrouperTransactionType
- public ByHql setCacheable(Boolean cacheable)
cacheable
- the cacheable to setpublic String toString()
public ByHql createQuery(String theHqlQuery)
theHqlQuery
- public ByHql setCacheRegion(String cacheRegion)
cacheRegion
- the cacheRegion to setpublic ByHql setCollectionInClause(StringBuilder query, Collection<?> params)
query
- params
- collection of params, note, this is for an inclause, so it cant be nullpublic ByHql setLong(String bindVarName, Long value)
bindVarName
- value
- is long, primitive so not nullpublic ByHql setInteger(String bindVarName, Integer value)
bindVarName
- value
- is long, primitive so not nullpublic <T> T uniqueResult(Class<T> 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);
T
- is the templatereturnType
- type of the result (in future can use this for typecasting)GrouperDAOException
public void executeUpdate() throws GrouperDAOException
call hql executeUpdate, e.g. delete or update statement
GrouperDAOException
- TODO remove in new grouper versionpublic int executeUpdateInt() throws GrouperDAOException
call hql executeUpdate, e.g. delete or update statement
GrouperDAOException
- TODO remove in new grouper versionpublic <T> List<T> list(Class<T> returnType)
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);
T
- is the templatereturnType
- type of the result (can typecast)GrouperDAOException
public <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 value 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 mapGrouperDAOException
public <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)GrouperDAOException
public ByHql options(QueryOptions queryOptions1)
queryOptions1
- public ByHql setDouble(String bindVarName, Double value)
bindVarName
- value
- is doublepublic edu.internet2.middleware.grouper.hibernate.ByQueryBase setIgnoreHooks(boolean theIgnoreHooks)
theIgnoreHooks
- public boolean isIgnoreHooks()
protected void copyFieldsTo(edu.internet2.middleware.grouper.hibernate.ByQueryBase byQueryBase)
byQueryBase
- protected HibernateSession getHibernateSession()
protected edu.internet2.middleware.grouper.hibernate.ByQueryBase set(HibernateSession theHibernateSession2)
theHibernateSession2
- is the session to reusepublic static void main(String[] args)
args
- Copyright © 2016 Internet2. All rights reserved.