I have the following domain model:
@Entity
public class Sample {
// id and other stuff
private boolean deleted;
private Set<Occurrence> occurrences;
// Constructors, getter and setter
}
@Entity
public class Occurrence {
// id and other stuff
private boolean deleted;
private Classification classification;
// Constructors, getter and setter
}
@Entity
public class Classification {
private int id;
// other stuff
}
I want to find with QueryDSL and Spring Data JPA all Samples which are not deleted and contain an occurrence witch is not deleted and contains a classification with the id 47.
I allready have a BooleanExpression for the not deleted samples: qSample.deleted.isFalse() and a SubQuery for the not delted occurrence which has a certain classification id:
JPASubQuery occurrenceSubQuery = new JPASubQuery();
QOccurrence qOccurrence = QOccurrence.occurrence;
occurrenceSubQuery.from().where(
qOccurrence.in(qSample.occurrences),
qOccurrence.deleted.isFalse(),
qOccurrence.classification.id
.eq(queryId));
What's missing is: how to bring these parts together to a predicate for the spring data repository?
Regards
Daniel