We have an object that contains value types and we'd like to save these value types in a separate table with the life cycle of those value types being controlled by the main table, in other words there is no primary key for the value type table. We tried the composite element for the set to specify the value type and the table name was given as part of the set element. When we tried to save this we were getting a ClassCastException and Hibernate would'nt tell us what we were doing wrong. Has anyone faced a similar problem before, is so can you share your inputs here, are we doing the right thing as far as dealing with value types ?
<set name="dueDateRanges" inverse="false" lazy="false" cascade="all" table="CriteriaDueDateRanges">
<key column ="criteriaID" not-null="true" />
<composite-element class="DateRange">
<property name="startDate" column="startdate"/>
<property name="endDate" column="enddate"/>
</composite-element>
</set>
In the above configuration the DateRange table is the value type that we want saved in CriteriaDueDateRanges.
|