Converted jpql queries to criteria queries.