I have the following mapping in hibernate 3.2.6:
Code:
<class name="Persona" table="TBMHABPERSONA">
... more properties ...
<set name="cursosPersona" lazy="true" fetch="select" inverse="true" order-by="ANIOFINALIZACION ASC">
<key column="IDPERSONA" />
<one-to-many class="CursoPersona" />
</set>
</class>
<class name="CursoPersona" table="TBRHABCURSOPERSONA">
...more properties...
<property name="anioCurso" column="ANIOFINALIZACION" type="string" not-null="true" />
<many-to-one name="curso" column="IDCURSO" lazy="proxy" not-null="true" class="Curso" />
</class>
<class name="Curso" table="TBMHABCURSO">
...more properties...
<property name="descripcion" column="DECURSO" type="string" length="200" not-null="true" />
</class>
So, I have an entity called Persona. Each one has several CursoPersona, and each CursoPersona relates to an entity of type Curso. CursoPersona is an entity that relates Persona and Curso, but it contains some extra data, so I can't use a Many-to-many relationship.
The set "cursosPersona" in the entity Persona, is ordered by column ANIOFINALIZACION, which is in CursoPersona. That's easy, because I order by a field that is on the table referenced by the set
But I'd like to add an extra ordering token using column DECURSO, which is on the entity Curso. How can I do that?