How to do inner join using only ID in Hibernate Criteria API?
Assume I have this mapping:
class User {
String name;开发者_高级运维
...
}
class Department {
String id;
User owner;
...
}
class Employee {
String departmentId; //legacy code, I cannot change this
}
I want to query all Employee
s sorted by their department owner's name (sorted by Employee.departmentId.owner.name
) using Hibernate Criteria API.
Criteria api or hql works with relational mapping so you can not use something like departmentId.owner.name. But there are some solutions here.
精彩评论