protected void splitCriteria ( ) { Criteria whereCrit = getQuery ( ) . getCriteria ( ) ; Criteria havingCrit = getQuery ( ) . getHavingCriteria ( ) ; if ( whereCrit == null || whereCrit . isEmpty ( ) ) { getJoinTreeToCriteria ( ) . put ( getRoot ( ) , null ) ; } else { // TODO: parameters list shold be modified when the form is reduced to DNF. getJoinTreeToCriteria ( ) . put ( getRoot ( ) , whereCrit ) ; buildJoinTree ( whereCrit ) ; } if ( havingCrit != null && ! havingCrit . isEmpty ( ) ) { buildJoinTree ( havingCrit ) ; } }
First reduce the Criteria to the normal disjunctive form then calculate the necessary tree of joined tables for each item then group items with the same tree of joined tables .