Well, I
think I just stumbled across something that is working, but it may not be the prettiest way. It also doesn't have all of the PK compositions that I'd like.
I had to add an extra class (Name.java) just to wrap a String in order to map it to its own table.
The remaining problem is that the FeaturePlaceName table doesn't have the composite PK of Feature_ID (FK) and Name_ID (FK) that I'd like. Any idea how I can accomplish this?
Mappings:
Code:
<class name="Feature" table="Feature">
<id name="id" column="Feature_ID">
<generator class="native"/>
</id>
<set name="names" table="FeaturePlaceName"
cascade="save-update">
<key column="Feature_ID"/>
<one-to-many class="PlaceName"/>
</set>
</class>
<class name="PlaceName" table="FeaturePlaceName">
<id name="id" column="PlaceName_ID">
<generator class="native"/>
</id>
<property name="isHistorical" column="Is_Historical"/>
<many-to-one name="name" class="Name"
column="name" cascade="save-update" fetch="join"/>
</class>
<class name="Name" table="PlaceName">
<id name="name"/>
</class>
Thanks again!
Dave