Refactor and split HibernateCriteriaBuilder so more code is shared between Hibernate 3 and 4