Hi There,
I've searched the documentation and forum but can not find an answer to my particular question.
I have a Product object which contains a list of Software Versions (each product can contain may software versions, each software version is for just one product).
My Software Version table has an autogenerated (sequence) id field and a not null foreign key to the Product Id.
I do NOT want my SoftwareVersion object to contain a link to the Product, it contains no reference at all to the Product.
I only want my Product Object to have a list of software versions.
When I try to save the Product (with a new SoftwareVersion added to the list) it complains that it can't insert a null into the product_id field of the SoftwareVersion table.
How do I get Hibernate to use the product_id from the Product object.
The only relationship between the product and software version is in my product.hbm.xml file as follows:
...
<list name="softwareVersionList" cascade="save-update" lazy="false">
<key column="product_id"/>
<index column="product_id"/>
<one-to-many class="nz.co.vodafone.phalanx.model.SoftwareVersion"/>
</list>
Your urgent assistance with this would be much appreciated.
Thanks
Craig.
|