... <class name="MyOwningEntity"> <id name="id"> <generator class="org.hibernate.id.SequenceGenerator"> <param name="sequence">hibernate_sequence</param> </generator> </id> <map name="keyValueMap" cascade="all"> <key column="MY_OWNING_ENTITY_ID" /> <map-key-many-to-many column="KEY_ID" class="MyKeyEntity" /> <many-to-many column="VALUE_ID" class="MyValueEntity" /> </map> </class> ... </hibernate-mapping>
With the above configuration, save cascades to the values, but not to the keys. See the attached project and tests.