title: Hibernate: Mapping many-to-many without a join table
body: <p>Consider the following 2 tables in my database:</p>
  
  <pre><code>FUNCTION_TABLE
  
  FUNC_CD     |   INPUT_ATTR_ID   |   OUTPUT_ATTR_ID
  multiply    |   1               |   3
  multiply    |   2               |   3
  multiply    |   4               |   6 
  multiply    |   5               |   6
  
  ATTRIBUTE_TABLE
  
  ATTR_ID     |   ATTR_NAME
  1           |   AttributeOne
  2           |   AttributeTwo
  etc
  </code></pre>
  
  <p>My Function class should contain the following:</p>
  
  <pre><code>public class Function {
      private String functionCode;
      private Set&lt;Attribute&gt; inputAttributes;
      private Attribute outputAttribute;
  }
  </code></pre>
  
  <p>My Function DAO then will contain a method that returns a Function object for the specified outputAttribute</p>
  
  <p>How do I map this? Any examples I see require a join table for collections.</p>
  
  <p>My mapping contains the following so far:</p>
  
  <pre><code>&lt;class name="my.Function" table="FUNCTION_TABLE"&gt;
      &lt;id name="functionCode" column="FUNC_CD" type="java.lang.String" /&gt;
      &lt;many-to-one name="outputAttribute" class="my.Attribute" column="OUTPUT_ATTR_ID"/&gt;
  &lt;/class&gt;
  </code></pre>
  
  <p>However, I'm at a loss on how to map the input attributes as  requires another table</p>