Hi,
i cannot use sorting on join tables. Let me explain.
i have three tables. users, roles and user_roles.
my entities are User, UserRole, UserRolePK, Role.
Code:
|User | | UserRole | | UserRplePK | | Role |
|--------| |----------| -------------- --------
|id | | pk | | user | | id |
|name | | role | | name |
this is what i wanted to:
"SELECT * FROM user_roles ur JOIN users u ON u.ID = ur.UserID ORDER BY u.name;"
Code:
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