tdtd wrote:
Is there a different way to get the HBM_INDEX value from the mapping?
You can refer to the map index column name directly.  However, the column name has to be unique within the query.
E.g., assuming:
Code:
<class name="FooClass">
   ...
   <map name="theMap" lazy="true">
      <key column='theFoo' />
      <index-many-to-many 
         column="theIndex" 
         class="IndexClass" />
      <many-to-many 
         column="theValue" 
         class="ValueClass" /> 
   </map>
</class>
You would normally write something like:
Code:
select ... 
    from FooClass as myFoo
    left outer join foo.theMap as myMap
where
    index(myMap) = 42 and ...
But index() won't work, so you can write:
Code:
select ... 
    from FooClass as myFoo
    left outer join foo.theMap as myMap
where
    theIndex = 42 and ...
This will not work if there's a column named "theIndex" in either FooClass or ValueClass, because the joins will create a name collision.