• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

hibernate disable foreign keys  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
ranger
Sheriff
Posts: 17314
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
gustavo sanchez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks !
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!