Ok, so this is probably a rare case, but what I'm trying to do is this:
There's an Exam entity and a TakenExam entity. The TakenExam entity references the Exam entity and a User who took the exam. There may be many TakenExam's for every Exam (or none). I'm trying to build a report of the available exams for a particular user with the information about whether they've passed the exam before, etc. Right now I'm doing this with an HQL query like this:
Quote:
select new eg.ExamInfo(exam.id, exam.name, exam.description, TakenExam.passed, takenExam.creationDate)
from PersistentTakenExam takenExam right outer join takenExam.exam exam
where takenExam.examinee = ? and exam.published = true
The association is one way, there's no association from Exam to TakenExam, so I'm doing a right outer join to get all of the exams with their corresponding TakenExams if they exist.
I'd really like to be able to model this using the Criteria API using the ResultTransformer to create my DTO object like the "select new" is doing above, but, although I found some posts about left outer join support in the Criteria API (and it only seems to be in the Criteria, not DetachedCriteria for some reason), there's nothing I could find for right outer join support. I'd like to create a DetachedCriteria for this so I can easily add more filters and ordering to the query at runtime. We've already got a bunch of infrastructure around adding these to a Criteria, and I don't relish doing string concatenation to try to get this working.
Any help appreciated!