Protoype for Criteria query using subqueries