Hibernate version:3.2.6
I have the following mapping, when I have Circuit object, I can get users by circuit.getUsers(), which is sort by user id.
But in another jsp, I have to display users by user name.
I want to sort it on database level, I have to write another DAO or define another set mapping.
Is there a easier way?
Thanks a lot.
Code:
<hibernate-mapping>
<class name="arden.persistence.model.Circuit" table="df_gym_circuit">
...
<set name="users" inverse="false" table="df_gym_user_circuit" order-by="user_id asc">
<key>
<column name="circuit_id" not-null="true" />
</key>
<many-to-many entity-name="arden.persistence.model.User">
<column name="user_id" not-null="true" />
</many-to-many>
</set>
...