Hi, i cannot use sorting on join tables. Let me explain;
i have three tables. users, roles and user_roles. my JPA entities are User, UserRole, UserRolePK, Role.
|User | | UserRole | | UserRolePK | | Role |
|--------| |----------| -------------- --------
|id | | pk | | user | | id |
|name | | role | | name |
in fact the output that i want is: "SELECT * FROM user_roles ur JOIN users u ON u.ID = ur.UserID ORDER BY u.name;"
so i try to use hibernate criteria API.
CriteriaImpl criteria = (CriteriaImpl) session.createCriteria(UserRole.class);
criteria.addOrder(Order.asc("pk.user.name"));
List userRoles = criteria.list();
The error is could not resolve property: pk.user.name of: models.UserRole
how can i use criteria API on join tables?