Definition:
A map is a simple name-value pair list stored on a first rank collection.
Scenario:
Hibernate Mapping
在hbm.xml中設定如下:
<class name="Foo" table="foo">
...
<map role="ages">
<key column="id"/>
<index column="name" type="string"/>
<element column="age" type="string"/>
</map>
</class>
Table Schema
A simple extra table, Ages, is used to store the name and age string-value pair. Note that the map needs its own identity column too: id
Bidirectionality:
Bidirectionality has no meaning for a map.