Class BySqlStatic
java.lang.Object
edu.internet2.middleware.grouper.hibernate.BySqlStatic
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.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
attachParams
(PreparedStatement statement, Object params) Deprecated.doesnt work with postgres, pass in types explicitlystatic void
attachParams
(PreparedStatement statement, Object params, Object types) Attach params for a prepared statement.static List<org.hibernate.type.Type>
convertParamsToTypes
(Object params) Deprecated.doesnt work with postgres.int
executeSql
(String sql) execute some sqlint
executeSql
(String sql, List<Object> params) Deprecated.doesnt work with postgres, need to pass in param types explicitly since cant determine them if nullint
executeSql
(String sql, List<Object> params, List<org.hibernate.type.Type> types) execute some sql<T> List<T>
listSelect
(Class<T> returnClassType, String sql, List<Object> params) Deprecated.doesnt work with postgres, need to pass in param types explicitly since cant determine them if null<T> List<T>
listSelect
(Class<T> returnClassType, String sql, List<Object> params, List<org.hibernate.type.Type> types) select one object from sql (one row, one col<T> List<T>
listSelectHiberateMapped
(Class<T> returnClassType, String query, List<Object> params) Deprecated.doesnt work with postgres, need to pass in param types explicitly since cant determine them if null<T> List<T>
listSelectHiberateMapped
(Class<T> returnClassType, String query, List<Object> params, List<org.hibernate.type.Type> types) select one object from sql (one row, one col<T> T
select one object from sql (one row, one col<T> T
Deprecated.doesnt work with postgres, need to pass in param types explicitly since cant determine them if null<T> T
select
(Class<T> returnClassType, String sql, List<Object> params, List<org.hibernate.type.Type> types) select one object from sql (one row, one col
-
Method Details
-
executeSql
execute some sql- Parameters:
sql
- can be insert, update, delete, or ddl- Returns:
- the number of rows affected or 0 for ddl
-
executeSql
Deprecated.doesnt work with postgres, need to pass in param types explicitly since cant determine them if nullexecute some sql- Parameters:
sql
- can be insert, update, delete, or ddlparams
- prepared statement params- Returns:
- the number of rows affected or 0 for ddl
-
executeSql
execute some sql- Parameters:
sql
- can be insert, update, delete, or ddlparams
- prepared statement paramstypes
- is the types of the params- Returns:
- the number of rows affected or 0 for ddl
-
select
select one object from sql (one row, one col- Type Parameters:
T
- the type- Parameters:
returnClassType
- type to be returned (currnetly supports string and intsql
- can be insert, update, delete, or ddl- Returns:
- the number of rows affected or 0 for ddl
-
select
Deprecated.doesnt work with postgres, need to pass in param types explicitly since cant determine them if nullselect one object from sql (one row, one col- Type Parameters:
T
- the type- Parameters:
returnClassType
- type to be returned (currnetly supports string and intsql
- can be insert, update, delete, or ddlparams
- prepared statement params- Returns:
- the number of rows affected or 0 for ddl
-
select
public <T> T select(Class<T> returnClassType, String sql, List<Object> params, List<org.hibernate.type.Type> types) select one object from sql (one row, one col- Type Parameters:
T
- the type- Parameters:
returnClassType
- type to be returned (currnetly supports string and intsql
- can be insert, update, delete, or ddlparams
- prepared statement paramstypes
- types of params- Returns:
- the number of rows affected or 0 for ddl
-
listSelectHiberateMapped
public <T> List<T> listSelectHiberateMapped(Class<T> returnClassType, String query, List<Object> params) Deprecated.doesnt work with postgres, need to pass in param types explicitly since cant determine them if nullselect one object from sql (one row, one col- Type Parameters:
T
- the type- Parameters:
returnClassType
- type to be returned (currnetly supports string and intquery
- can be insert, update, delete, or ddlparams
- prepared statement params- Returns:
- the number of rows affected or 0 for ddl
-
listSelectHiberateMapped
public <T> List<T> listSelectHiberateMapped(Class<T> returnClassType, String query, List<Object> params, List<org.hibernate.type.Type> types) select one object from sql (one row, one col- Type Parameters:
T
- the type- Parameters:
returnClassType
- type to be returned (currnetly supports string and intquery
- can be insert, update, delete, or ddlparams
- prepared statement paramstypes
- types of params- Returns:
- the number of rows affected or 0 for ddl
-
listSelect
@Deprecated public <T> List<T> listSelect(Class<T> returnClassType, String sql, List<Object> params) Deprecated.doesnt work with postgres, need to pass in param types explicitly since cant determine them if nullselect one object from sql (one row, one col- Type Parameters:
T
- the type- Parameters:
returnClassType
- type to be returned (currnetly supports string and intsql
- can be insert, update, delete, or ddlparams
- prepared statement params- Returns:
- the number of rows affected or 0 for ddl
-
listSelect
public <T> List<T> listSelect(Class<T> returnClassType, String sql, List<Object> params, List<org.hibernate.type.Type> types) select one object from sql (one row, one col- Type Parameters:
T
- the type- Parameters:
returnClassType
- type to be returned (currnetly supports string and intsql
- can be insert, update, delete, or ddlparams
- prepared statement paramstypes
-- Returns:
- the number of rows affected or 0 for ddl
-
attachParams
@Deprecated public static void attachParams(PreparedStatement statement, Object params) throws org.hibernate.HibernateException, SQLException Deprecated.doesnt work with postgres, pass in types explicitlyAttach params for a prepared statement. The type of the params and types must be the same (e.g. either both array or list, but not one is Array, and the other list- Parameters:
statement
-params
- either null, Object, Object[], or List of Objects- Throws:
org.hibernate.HibernateException
SQLException
-
convertParamsToTypes
Deprecated.doesnt work with postgres. pass in types explicitlyconvert params to types- Parameters:
params
-- Returns:
- the types
-
attachParams
public static void attachParams(PreparedStatement statement, Object params, Object types) throws org.hibernate.HibernateException, SQLException Attach params for a prepared statement. The type of the params and types must be the same (e.g. either both array or list, but not one is Array, and the other list- Parameters:
statement
-params
- either null, Object, Object[], or List of Objectstypes
- either null, Type, Type[], or List of Objects- Throws:
org.hibernate.HibernateException
SQLException
-