edu.internet2.middleware.grouper.hibernate
Class BySql

java.lang.Object
  extended by edu.internet2.middleware.grouper.hibernate.BySql

public class BySql
extends Object

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.

Author:
mchyzer

Field Summary
static int queryCountQueries
          query count exec queries, used for testing
 
Constructor Summary
BySql(HibernateSession theHibernateSession)
           
 
Method Summary
 BySql createQuery(String theHqlQuery)
          set the query to run
 int executeSql(String sql, List<Object> params)
          execute some sql
 boolean isIgnoreHooks()
          if we should ignore hooks
static void main(String[] args)
           
 BySql setGrouperTransactionType(GrouperTransactionType theGrouperTransactionType)
          assign a different grouperTransactionType (e.g.
 edu.internet2.middleware.grouper.hibernate.ByQueryBase setIgnoreHooks(boolean theIgnoreHooks)
          if we should ignore hooks
 String toString()
          string value for error handling
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

queryCountQueries

public static int queryCountQueries
query count exec queries, used for testing

Constructor Detail

BySql

public BySql(HibernateSession theHibernateSession)
Parameters:
theHibernateSession -
Method Detail

setGrouperTransactionType

public BySql setGrouperTransactionType(GrouperTransactionType theGrouperTransactionType)
assign a different grouperTransactionType (e.g. for autonomous transactions)

Parameters:
theGrouperTransactionType -
Returns:
the same object for chaining

toString

public String toString()
string value for error handling

Overrides:
toString in class Object
Returns:
the string value

createQuery

public BySql createQuery(String theHqlQuery)
set the query to run

Parameters:
theHqlQuery -
Returns:
this object for chaining

executeSql

public int executeSql(String sql,
                      List<Object> params)
execute some sql

Parameters:
sql - can be insert, update, delete, or ddl
params - prepared statement params
Returns:
the number of rows affected or 0 for ddl

setIgnoreHooks

public edu.internet2.middleware.grouper.hibernate.ByQueryBase setIgnoreHooks(boolean theIgnoreHooks)
if we should ignore hooks

Parameters:
theIgnoreHooks -
Returns:
if we should ignore hooks

isIgnoreHooks

public boolean isIgnoreHooks()
if we should ignore hooks

Returns:
if we should ignore hooks

main

public static void main(String[] args)
Parameters:
args -