onur wrote:
The thing is,
using Subqueries.properyEq(String, DetachedCriteria), how will I say
Educations.A = x
in the code quoted, membersCriteria is instance of Criteria, however this method requests DetachedCriteria
The subqueries are created as DetachedCriteria. There shouldn't be any difference from a regular query. For example,
Code:
DetachedCriteria educationsCriteria = DetachedCriteria.forClass(Education.class);
educationsCriteria.add(Restrictions.eq("A", "X"));
// same for careersCriteria...
membersCriteria = createCriteria(Member.class);
membersCriteria.add(
Restrictions.disjunction()
.add(Subqueries.propertyEq("careers", careersCriteria))
.add(Subqueries.propertyEq("educations", educationsCriteria)))
membersCriteria.list();
The external query will return only those members that the subquries succeeded for. You may need to use DISTINCT_ROOT_ENTITY though, to avoid duplicate members.
HTH