I'm not very sure, but probably something like this:
Code:
<class name="TFirm" table="firms">
<id name="id" />
</class>
<class name="TRole" table="roles">
<id name="id" />
</class>
<class name="TUser" table="users">
<id name="id" />
<map name="roles" table="users_roles">
<key column="user_id" />
<index-many-to-many column="firm_id" class="TFirm" />
<many-to-many column="role_id" class="TRole"></many-to-many>
</map>
</class>
This might help you
http://ndpsoftware.com/HibernateMappingCheatSheet.html
Another solution would be to have the RoleInFirm intermediary class used to encode/decode Map<Firm, List<Role>>.
Hope it helps...