Class 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 Detail

      • QueryTimeOutUtil

        public QueryTimeOutUtil()
    • 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