title: How do you map a "Map" in hibernate using annotations?
body: <p>Using annotations how do you map a field in an entity which is a "Map" (Hashtable) of String to a given object? The object is annotated and instances of it are already stored in the hibernate databse.</p>
  
  <p>I've found the syntax for definging a map with a simple key and value as such:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;class name="Foo" table="foo"&gt;
      ...
      &lt;map role="ages"&gt;
           &lt;key column="id"/&gt;
           &lt;index column="name" type="string"/&gt;
           &lt;element column="age" type="string"/&gt;
       &lt;/map&gt;
   &lt;/class&gt;
  </code></pre>
  
  <p>And oddly with an entity as the key and a simple type as the value like so:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;class name="Foo" table="foo"&gt;
      ...
    &lt;map role="ages"&gt;
      &lt;key column="id"/&gt;
      &lt;index-many-to-many column="person_id" 
           class="Person"/&gt;
      &lt;element column="age" type="string"/&gt;
    &lt;/map&gt;
  &lt;/class&gt;
  &lt;class name="Person" table="person"&gt;
      ...
      &lt;property name="name" column="name" 
           type="string"/&gt;
  &lt;/class&gt;
  </code></pre>
  
  <p>But I don't see how to do this for a simple key to element mapping, and I don't see how to do this using annotations.</p>