This question is related to my previous one (one-to-many mapping with multiple parents), but takes a different approach. Is there any way to tell hibernate not to generate a foreign key constraint (using hbm2ddl.auto) between these two tables. While one seems to exist in this mapping, I don't want the database constraint there.
The docs imply that this foreign key is implicit to the relationship between the parent class and its collection, but I'm wondering if there's just a way to "turn off" the constraint generation (just for this relationship). Thanks.
Hibernate version: 3.1 rc2
Mapping documents:
Code:
<class name="Parent" table="PARENTS">
<id name="guid" column="PARENT_ID"/>
<property name="name" column="NAME"/>
<set name="childSet"
table="CHILDREN"
lazy="false"
cascade="save-updae,persist">
<key column="CHILD_ID"/>
<one-to-many class="Child"/>
</set>
</class>
Code between sessionFactory.openSession() and session.close():
session.save(new Parent("Fred"));
Name and version of the database you are using:
HSQL