Reputation: 1
i have a domain class which looks like this
public class User {
...
@OneToMany
@MapKeyEnumerated(EnumType.STRING)
@JoinTable(
name="user_result",
joinColumns=@JoinColumn(name="user_id"),
inverseJoinColumns=@JoinColumn(name="result_id")
)
@MapKeyColumn(name="step")
public Map<EStep, Result> getResults() {
return results;
}
...
}
now i am trying to write a hql which lists all of my users ordered by a property (e.g. score) of the class Result for the key EStep.STEP_1.
is it even possible to do such queries in hql?
Upvotes: 0
Views: 187
Reputation: 3694
Yes in HSQL it is possible. But it is also possible with Criteria
.
Criteria c = session.createCriteria(Cat.class);
c.createAlias("mother.kind", "motherKind");
c.addOrder(Order.asc("motherKind.value"));
return c.list();
hsql order by example
String hql = "from Survey p order by p.price asc";
Query query = session.createQuery(hql);
List results = query.list();
Upvotes: 1