How do I run a query with no special Hibernate filtering enabled?

Broadleaf utilizes a series of hibernate filters that enhances SQL queries to make sure that basic rules remain in place for sandboxes, archiving, site/catalog, etc.  Out of the box, these filters are enabled and in most cases provide the needed query constraints to make sure you are using the current site/catalog, the correct sandbox, that you are only showing active rows (archive), etc.

There are cases that you may want to disable these filters and execute a query that has not been modified.  To do that, we can notify the system to ignore these filters.  The below code demonstrates how this can be accomplished.  Note that when these filters are disabled, the developer is responsible for making sure any special SQL "where" clauses are in place - for example, making sure only non-archived rows are returned.

@Resource(name="blWorkflowStateManager") 
protected WorkflowStateManager workflowStateManager;


try { 
    workflowStateManager.startIgnoreFiltersState(); 
    //add your query here 
} finally { 
    workflowStateManager.endIgnoreFiltersState(); 
}