|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.internet2.middleware.grouper.hibernate.ByHql
public class ByHql
for simple HQL, use this instead of inverse of control. this will do proper error handling and descriptive exception handling. This will by default use the transaction modes GrouperTransactionType.READONLY_OR_USE_EXISTING, and GrouperTransactionType.READ_WRITE_OR_USE_EXISTING depending on if a transaction is needed.
Field Summary | |
---|---|
static int |
queryCountQueries
query count exec queries, used for testing |
Constructor Summary | |
---|---|
ByHql(HibernateSession theHibernateSession)
|
Method Summary | ||
---|---|---|
ByHql |
createQuery(java.lang.String theHqlQuery)
set the query to run |
|
void |
executeUpdate()
call hql executeUpdate, e.g. delete or update statement |
|
boolean |
isIgnoreHooks()
if we should ignore hooks |
|
|
list(java.lang.Class<T> returnType)
call hql list result e.g. |
|
|
listMap(java.lang.Class<K> keyClass,
java.lang.Class<V> valueClass,
java.lang.String keyPropertyName)
call hql list result, and put the results in map with the key as one of the fields |
|
|
listSet(java.lang.Class<S> returnType)
call hql list result, and put the results in an ordered set e.g. |
|
static void |
main(java.lang.String[] args)
|
|
ByHql |
options(QueryOptions queryOptions1)
add a paging/sorting/resultSetSize, etc to the query |
|
ByHql |
setCacheable(java.lang.Boolean cacheable)
assign if this query is cacheable or not. |
|
ByHql |
setCacheRegion(java.lang.String cacheRegion)
cache region for cache |
|
ByHql |
setCollectionInClause(java.lang.StringBuilder query,
java.util.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(java.lang.String bindVarName,
java.lang.Double value)
assign data to the bind var |
|
ByHql |
setGrouperTransactionType(GrouperTransactionType theGrouperTransactionType)
assign a different grouperTransactionType (e.g. for autonomous transactions) |
|
edu.internet2.middleware.grouper.hibernate.ByQueryBase |
setIgnoreHooks(boolean theIgnoreHooks)
if we should ignore hooks |
|
ByHql |
setInteger(java.lang.String bindVarName,
java.lang.Integer value)
assign data to the bind var |
|
ByHql |
setLong(java.lang.String bindVarName,
java.lang.Long value)
assign data to the bind var |
|
ByHql |
setScalar(java.lang.String bindVarName,
java.lang.Object value)
assign data to the bind var |
|
ByHql |
setString(java.lang.String bindVarName,
java.lang.String value)
assign data to the bind var |
|
ByHql |
setTimestamp(java.lang.String bindVarName,
java.util.Date value)
assign data to the bind var |
|
java.lang.String |
toString()
string value for error handling |
|
|
uniqueResult(java.lang.Class<T> returnType)
call hql unique result (returns one or null) e.g. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static int queryCountQueries
Constructor Detail |
---|
public ByHql(HibernateSession theHibernateSession)
theHibernateSession
- Method Detail |
---|
public void setConvertHqlColumnsToObject(boolean theConvertHqlColumnsToObject)
theConvertHqlColumnsToObject
- public ByHql setTimestamp(java.lang.String bindVarName, java.util.Date value)
bindVarName
- value
-
public ByHql setGrouperTransactionType(GrouperTransactionType theGrouperTransactionType)
theGrouperTransactionType
-
public ByHql setCacheable(java.lang.Boolean cacheable)
cacheable
- the cacheable to set
public java.lang.String toString()
toString
in class java.lang.Object
public ByHql createQuery(java.lang.String theHqlQuery)
theHqlQuery
-
public ByHql setCacheRegion(java.lang.String cacheRegion)
cacheRegion
- the cacheRegion to set
public ByHql setCollectionInClause(java.lang.StringBuilder query, java.util.Collection<?> params)
query
- params
- collection of params, note, this is for an inclause, so it cant be null
public ByHql setString(java.lang.String bindVarName, java.lang.String value)
setString
in interface HqlQuery
bindVarName
- value
-
public ByHql setLong(java.lang.String bindVarName, java.lang.Long value)
bindVarName
- value
- is long, primitive so not null
public ByHql setInteger(java.lang.String bindVarName, java.lang.Integer value)
bindVarName
- value
- is long, primitive so not null
public <T> T uniqueResult(java.lang.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
public <T> java.util.List<T> list(java.lang.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> java.util.Map<K,V> listMap(java.lang.Class<K> keyClass, java.lang.Class<V> valueClass, java.lang.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 map
GrouperDAOException
public <S> java.util.Set<S> listSet(java.lang.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 setScalar(java.lang.String bindVarName, java.lang.Object value)
setScalar
in interface HqlQuery
bindVarName
- value
- is long, primitive so not null
public ByHql options(QueryOptions queryOptions1)
queryOptions1
-
public ByHql setDouble(java.lang.String bindVarName, java.lang.Double value)
bindVarName
- value
- is double
public edu.internet2.middleware.grouper.hibernate.ByQueryBase setIgnoreHooks(boolean theIgnoreHooks)
theIgnoreHooks
-
public boolean isIgnoreHooks()
public static void main(java.lang.String[] args)
args
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |