Forums Register Login

hibernate disable foreign keys

+Pie Number of slices to send: Send
I need to disable the creation of foreign keys when <property name="hbm2ddl.auto">update</property> is set, cause when i delete the FK and aplication restart, hibernate create all the FK again.
When i was using MySql, hibernate does not create the FK contraints, but when i switch to Microsoft SQL server, it create the constraints but i need to delete it cause im inserting data with PK of other database
+Pie Number of slices to send: Send
I believe you need to map it as nullable="true" so that it doesn't automatically create a FK constraint in the DDL.

Some Databases support FK creation and some does not, that might be why you see one Database create a FK and one doesn't.

Mark
+Pie Number of slices to send: Send
thanks !
There's a city wid manhunt for this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 7037 times.
Similar Threads
help me understand this key mapping in "Hibernate in Action"
Hibernate Composite keymapping
Cannot connect to MySQL server ...
.JDBCConnectionException
Hibernate and Triggers
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 03:52:39.