Hi everybody,
I just need help with the order, I'm using criteria. I have a class Exam that have a OneToMany relation with a class ExamQuestion, and in this class I have a ManyToOne relation with Question and another relation with Exam and it's also ManyToOne. Question have a ManyToOne relation with Area and area have the property areaName. I'm retriving a Exam by his Id, and with this all the question of this exam. I want to order the Questions by the property areaName that is in Area, but I don't know how to implement that order. I try this:
Exam examen = (Exam)session.createCriteria(Exam.class) .add(Restrictions.eq("idExam", idExam)) .addOrder(Order.asc("areaName")) .uniqueResult();
|