OK, as suggested earlier and after lots of experimenting I can now get xdoclet to generate a mapping.
In my Person pojo, I did the following:
Code:
/**
* @hibernate.map
* @hibernate.collection-key column="PersonID"
* @hibernate.collection-index column="address_type" type="string"
* @hibernate.collection-one-to-many class="com.chisq.common.bo.Address"
*/
public Map getAddresses() {
return addresses;
}
public void setAddresses(Map addresses) {
this.addresses = addresses;
}
which xdoclet generates:
Code:
<map
name="addresses"
lazy="false"
sort="unsorted"
cascade="none"
>
<key
column="PersonID"
>
</key>
<index
column="address_type"
type="string"
/>
<one-to-many
class="com.chisq.common.bo.Address"
/>
</map>
Which is all great! However, when I look in the schema that gets generated, I expected to see a table created called Addresses but I don't see one. Nor do I see any kind of column in the Person table that references Addresses. So I must not understand how maps work in hibernate. Could someone please enlighted me?