Example hibernate mapping xml for one to many by a join table

We have table trade_summary and table trades_comment, each entry in trade_summary has multiple comments in trades_comment table. However, the relationship between these two tables are stored in another join table trade_summary_comment. Each row in trade_summary_comment has two columns: trade_id and comment_id which are primary keys in those two tables. The hibernate mapping goes as follows:

<set name=”comments” table=”trade_summary_comment”>
<key column=”trade_id”/>
<many-to-many column=”comment_id” unique=”true” class=”bmo.hub.idp.entity.TradesComment” order-by=”updated desc”/>

In java code, we use set in TradeSummary class to store its comments:

private Set<TradesComment> comments = new TreeSet<TradesComment>();