one-to-many的排序可以通过配置一个order-by="** desc"即可实现
如:
Java代码
1.<set name="clubMessage" table="club_Message" inverse="true" cascade="delete" order-by="create_time desc">
2. <key column="club_id" />
3. <one-to-many class="com.test.item.club.domain.ClubMessageVO" />
4.</set>
<set name="clubMessage" table="club_Message" inverse="true" cascade="delete" order-by="create_time desc">
<key column="club_id" />
<one-to-many class="com.test.item.club.domain.ClubMessageVO" />
</set>
上面的hbm属性意义是:一个社区对应多条社区消息,同时将这些消息按create_time排序
如:
Java代码
1.<set name="clubMessage" table="club_Message" inverse="true" cascade="delete" order-by="create_time desc">
2. <key column="club_id" />
3. <one-to-many class="com.test.item.club.domain.ClubMessageVO" />
4.</set>
<set name="clubMessage" table="club_Message" inverse="true" cascade="delete" order-by="create_time desc">
<key column="club_id" />
<one-to-many class="com.test.item.club.domain.ClubMessageVO" />
</set>
上面的hbm属性意义是:一个社区对应多条社区消息,同时将这些消息按create_time排序