Hi all,
I have been wondering how to order by a joined object, e.g. an project creator's lastName. Now, I got an idea, but I am not sure whether it is good or not, or maybe somebody has a better one. Welcome other people to share. Thanks in advance. Following is my sql and entity classes:
Code:
"select new Project (creator, project)
from Project project
inner join project.createdBy creator
order by creator.lastName"
@Entity
public class Project {
...
private Person createdBy;
public Project (Person createdBy, Project project) {
...
this.createdBy = createdBy;
...
}
....
}
@Entity
public class Person {
...
private String lastName;
...
}