I have a tree structure where the class 
HierarchyNode acts as a base class. Furthermore, i have three classes (HierarchyRootNode, 
AlbumHierarchyNode, TrackHierarchyNode) which extends HierarchyNode.
My tree structure could look as follows:
- HierarchyRootNode
-- 
AlbumHierarchyNode---- 
AlbumHierarchyNode---- 
AlbumHierarchyNode-- TrackHierarchyNode
---- TrackHierarchyNode
---- TrackHierarchyNode
The problem:
The AlbumHierarchyNode has a collection "albums". Each album element has a collection "territories", which indicated in which territories the album can be distributed.
Now; how would i go about to load the entire tree structure - but only the albums for each AlbumHierarchyNode which belongs to a provided territory.
I've been looking high and low for a solution on this, but i can't really seem to come up with a working one...!
Any help highly appreciated.
Mapping:
Code:
<hibernate-mapping>
  <class name="com.tracker.mediacreator.db.entities.HierarchyNode" table="hierarchynode">
    <id column="id" length="36" name="id" type="com.tracker.mediacreator.db.usertypes.CustomUUID"/>
    <discriminator column="type" type="java.lang.String"/>
    <version column="updated" name="updated" type="java.util.Calendar" unsaved-value="null"/>
    <property column="name" length="200" name="name" type="java.lang.String"/>
    <many-to-one class="com.tracker.mediacreator.db.entities.HierarchyNode" column="parent_id" lazy="false" name="parent"/>
    <property column="status" length="1" name="status" not-null="true" type="java.lang.Integer"/>
    <property column="flag" length="1" name="flag" not-null="true" type="java.lang.Integer"/>
    <bag fetch="subselect" inverse="true" lazy="false" name="children" order-by="name asc">
      <key column="parent_id"/>
      <one-to-many class="com.tracker.mediacreator.db.entities.HierarchyNode"/>
    </bag>
    <subclass discriminator-value="ROOT" name="com.tracker.mediacreator.db.entities.HierarchyRootNode"/>
    <subclass discriminator-value="TRACK" name="com.tracker.mediacreator.db.entities.TrackHierarchyNode">
      <bag fetch="subselect" inverse="true" name="tracks">
        <key column="hierarchynode_id"/>
        <one-to-many class="com.tracker.mediacreator.db.entities.TrackHierarchyRelationship"/>
      </bag>
    </subclass>
    <subclass discriminator-value="ALBUM" name="com.tracker.mediacreator.db.entities.AlbumHierarchyNode" >
      <bag fetch="subselect" inverse="true" lazy="false" name="albums">
        <key column="hierarchynode_id"/>
        <one-to-many class="com.tracker.mediacreator.db.entities.AlbumHierarchyRelationship"/>
      </bag>
    </subclass>
  </class>
</hibernate-mapping>