It is difficult to answer this without knowing what the differences are between FolderA and FolderB. It does not look like you are actually subclassing FolderB from FolderA or vice versa (implementing an interface is not inheritance), so <joined-subclass> is not appropriate.
You need something like this in each mapped class (assumes a Set property to hold the collections), and since you are describing a many-to-many relation between FolderA and FolderB, you
may need a join table consisting of at least a folderA_id and folderB_id column which are foreign keys to the respective tables (and you have not disclosed whether you are using a table-per-class-hierarchy or table-per-subclass scheme. The following assumes the latter:
Code:
<hibernate-mapping>
<class name="FolderA" table="FolderA(?)"
<id name="id" column="FOLDER_ID">
<generator class="native" />
</id>
//====properties of FolderA class====
<set name="folderBs" table="<join-table>" cascade="save-update" >
<key>
<column name="folderA_id" />
</key>
<many-to-many class="FolderB" column="folderB_id" />
</set>
</hibernate-mapping>
It looks like the FileCabinet to Folder[A][B] is one-to-one?
Look at section 6 of the on-line documentation.
http://www.hibernate.org/hib_docs/v3/reference/en/html/collections.html