I had an object/table called Form with a 1 column primary key. Another table/object called Recipient had a compound primary key with one of those primary keys being a foreign key reference to the Form primary key. When I did HQL to load up an array of Forms, session.createQuery("from Form"), it loaded all the Recipients into a Recipient Set. I changed Form to have a compound primary key and use both of those keys in a Recipient compound key. Now the query call doesn't load the Recipient Set?! What am I missing?
I've included the Form and Recipient hbm.xml files.
Thanks,
Mike
************** FORM *************************
hibernate-mapping>
<class name="com.skywiresoftware.db.Form" lazy="false" schema="PUBLIC" table="FORM">
<composite-id name="compId" class="com.skywiresoftware.db.FormPK">
<key-property name="config" type="string" column="CONFIG" length="50"/>
<key-property name="formname" type="string" column="FORMNAME" length="50"/>
</composite-id>
<property name="category" type="string" column="CATEGORY" length="50"/>
........
<set name="recipientsSet" lazy="true">
<key>
<column name="FORMNAME" />
<column name="CONFIG" />
</key>
<one-to-many class="com.skywiresoftware.db.Recipient" />
</set>
</class>
</hibernate-mapping>
******************** RECIPIENT ********************
<hibernate-mapping>
<class name="com.skywiresoftware.db.Recipient" lazy="false" schema="PUBLIC" table="RECIPIENT">
<composite-id name="compId" class="com.skywiresoftware.db.RecipientPK">
<key-property name="config" type="string" column="CONFIG" length="50"/>
<key-property name="formname" type="string" column="FORMNAME" length="50" />
<key-property name="name" type="string" column="NAME" length="50"/>
</composite-id>
<property name="description" type="string" column="DESCRIPTION" length="50"/>
<property name="recCount" type="integer" column="REC_COUNT"/>
<many-to-one name="form" class="com.skywiresoftware.db.Form" update="false" insert="false" lazy="false">
<column name="FORMNAME" not-null="true" length="50"/>
<column name="CONFIG" not-null="true" length="50"/>
</many-to-one>
</class>
</hibernate-mapping>
|