开发者

How to do inner join using only ID in Hibernate Criteria API?

开发者 https://www.devze.com 2023-01-30 01:32 出处:网络
Assume I have this mapping: class User { String name;开发者_高级运维 ... } class Department { String id;

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 Employees 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消