Package org.openbravo.service.db
Class QueryTimeOutUtil
- java.lang.Object
-
- org.openbravo.service.db.QueryTimeOutUtil
-
- All Implemented Interfaces:
OBProvidable
,OBSingleton
public class QueryTimeOutUtil extends Object implements OBSingleton
Utility class with that allows to set a query timeout for hibernate queries, hibernate criterias and sql statements.- Author:
- AugustoMauch
-
-
Constructor Summary
Constructors Constructor Description QueryTimeOutUtil()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static QueryTimeOutUtil
getInstance()
static void
resetQueryTimeOut(Statement statement)
Sets the 0 the timeout of a sql statementstatic void
resetQueryTimeOut(org.hibernate.Criteria criteria)
Sets the 0 the timeout of a hibernate criteriastatic void
resetQueryTimeOut(org.hibernate.query.Query<?> query)
Sets the 0 the timeout of a hibernate queryvoid
setQueryTimeOut(Statement statement, String type)
Sets a timeout for a sql statement, if possiblevoid
setQueryTimeOut(org.hibernate.Criteria criteria, String type)
Sets a timeout for a hibernate criteria (i.e.void
setQueryTimeOut(org.hibernate.query.Query<?> query, String type)
Sets a timeout for a hibernate query, if possible
-
-
-
Method Detail
-
getInstance
public static QueryTimeOutUtil getInstance()
- Returns:
- the singleton instance of the QueryTimeOutUtil class
-
setQueryTimeOut
public void setQueryTimeOut(org.hibernate.query.Query<?> query, String type)
Sets a timeout for a hibernate query, if possible- Parameters:
query
-type
- query type, it will be used to fetch the proper timeout
-
setQueryTimeOut
public void setQueryTimeOut(org.hibernate.Criteria criteria, String type)
Sets a timeout for a hibernate criteria (i.e. OBCriteria), if possible- Parameters:
criteria
-type
- query type, it will be used to fetch the proper timeout
-
setQueryTimeOut
public void setQueryTimeOut(Statement statement, String type)
Sets a timeout for a sql statement, if possible- Parameters:
type
- query type, it will be used to fetch the proper timeout
-
resetQueryTimeOut
public static void resetQueryTimeOut(org.hibernate.query.Query<?> query)
Sets the 0 the timeout of a hibernate query
-
resetQueryTimeOut
public static void resetQueryTimeOut(org.hibernate.Criteria criteria)
Sets the 0 the timeout of a hibernate criteria
-
resetQueryTimeOut
public static void resetQueryTimeOut(Statement statement)
Sets the 0 the timeout of a sql statement
-
-