Hibernate version:
3.2
Mapping documents:
Code:
<class name="Foo" table="foo">
<id name="id" length="16" access="field" />
...
<set name="usedBy" inverse="true">
<key column="foo_id" />
<one-to-many class="Bar" not-found="ignore" />
</set>
</class>
Name and version of the database you are using:
MySQL 5.x
Hello
I have classes Foo and Bar.
Foo has a Set<Bar> usedBy;
So in my table bar there is a field "foo_id" which points to field "id" of table foo.
hbm2ddl tries to generate a foreign key for that relation, but I don't want to. Is it possible to force hbm2ddl to not generate an FK?
In the hbm2ddl documentation (Customizing the schema) it says: "Note that inverse="true" sides will not be considered by SchemaExport."
But, both SchemaUpdate and SchemaExport do generate this FK.
I don't want an FK because entries from table "foo" might be deleted later on. And that's why I also use not-found="ignore". Right now this is not possible with this FK.
Any solution for this problem?
thanks