@OrderBy: Sorting references
- by Sven Moschel
We have the following entity structure:
@Entity
public class SecurityRole {
private List<Account> accounts; // ManyToMany
}
@Entity
public class Account {
private Employee owner; // OneToOne
}
@Entity
public class Employee {
private String lastName;
}
A security role can have many accounts. A account always has an employee.
On the GUI we show the security roles in an mastertable. In the detail table we show the accounts of the role. To display the employee information we show "account.getOwner().getLastName()";
How can we use the @OrderBy annotation with this model? Is this possible? The problem is that the Account entity has no employee information that we can sort.