I have an object that holds a hashmap which maps to a different table. The table has 4 fields, a surrogate PK, the FK and the name and value colums which hold the hashmap data. When hibernate saves I get an error inserting null into the PK field. How would I specify a primary key field in a map subelement? My mapping is as follows:
<hibernate-mapping default-lazy="false" package="com.hmco.edison.common.domain" >
<class name="Session" table="SESSIONS" >
<id name="sessionId" column="SESSIONS_ID" type="int" /
.... other fields ....
<map name="sessionValues" lazy="false" table="SESSION_VALUES" cascade="all-delete-orphan">
<key column="SESSION_VALUES_ID"/><!-- FK ref -->
<map-key column="NAME" type="java.lang.String" />
<element column="VALUE" type="string" not-null="true" />
</map>
</class>
</hibernate-mapping>
|