I am using Hibernate version: 3.1
I have an XML hibernate mapping description:
Code:
<hibernate-mapping>
<class name="com.domain.MyClass" table="DATA_TABLE">
<id name="id" type="int" unsaved-value="null" >
<column name="PR_ID" />
<generator class="org.hibernate.id.Assigned"/>
</id>
<property name="field1" type="string">
<column name="PR_FIELD1" length="120"/>
</property>
...
<property name="field28" type="date">
<column name="PR_FIELD28"/>
</property>
<!-- Mapping For Image File -->
<join table="IMAGE_TABLE" fetch="join" optional="true">
<key column="IMG_PRID"/>
<property name="jpegData" type="blob">
<column name="IMG_DATA" />
</property>
</join>
</class>
</hibernate-mapping>
This works fine but I want to specify a constraint because there could be multiple images and I only want a one to one relationship.
Is is possible to do something like this:
Code:
<join table="IMAGE_TABLE" fetch="join" optional="true">
<key column="IMG_PRID"/>
<constraint column="IMAGE_NAME" value="MyImage" />
<property name="jpegData" type="blob">
<column name="IMG_DATA" />
</property>
</join>
My above code clearly does not work but I could not see how to translate this to a configuration that would work.
Thanks in advance,
Doug Culnane