Hi,
I've a user bean and a role bean, a typical structure to manage ACL. Every user may have roles, so every roles may "have" users.
There are three tables: role, user, role_user (the collection/ralation table).
Due to some constrain in the application and database, I've mapped, my be wrongly, the user's roles *List* with a bag, so Hibernate retrive all role's beans when I get a user.
Is there a way to populate that role's list with a predefined order (eg. by role name), asking the database to do an "order by" while retrieving roles?
I see Hibernate to execute the join-query between role and role_user tables. Just a way to append an order by clause? order-by attribute (only for jdk 1.4+) work only (?) on role_user's columns.
Or I need to reorder with a filter? I know about SortedSet, but I don't want to change, if possible, the bean definition.
Thanks, Satollo.
|