-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Order
PostPosted: Wed Jul 15, 2009 12:28 pm 
Newbie

Joined: Wed Jul 15, 2009 12:19 pm
Posts: 5
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();


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.