class BaseJpaDaoImpl implements BaseJpaDao {

    protected <T> Predicate getPredicateForInClause(CriteriaBuilder builder, Path<T> path, List<T> values)
    {
        // Get the chunk size from the environment and use a default as necessary.
        int inClauseChunkSize = configurationHelper.getProperty(ConfigurationValue.DB_IN_CLAUSE_CHUNK_SIZE, Integer.class);

        // Initializes the returned predicate and the value list size.
        Predicate predicate = null;
        int listSize = values.size();

        // Loop through each chunk of values until we have reached the end of the values.
        for (int i = 0; i < listSize; i += inClauseChunkSize)
        {
            // Get a sub-list for the current chunk of data.
            List<T> valuesSubList = values.subList(i, (listSize > (i + inClauseChunkSize) ? (i + inClauseChunkSize) : listSize));

            // Get an updated predicate which will be the "in" clause of the sub-list on the first loop or the "in" clause of the sub-list "or"ed with the\
            // previous sub-list "in" clause.
            predicate = (predicate == null ? path.in(valuesSubList) : builder.or(predicate, path.in(valuesSubList)));
        }

        // Return the "in" clause predicate.
        return predicate;
    }

}