Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

set null on delete of one to one relationship  RSS feed

Sharon Adar
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hibernate 3.2.1 w\ MySql

I�m having problem with the way hibernate manages one-to-one relationship.
Before starting, some history regarding the problem:\

As far as I�m concern, when creating a new one to one relationship between �myTable� and �My otherTable�, the creation SQL will define the constraints �on delete� default to �restrict�

SQL creation command example:

That causes be a lot of troubles when trying to remove myOtherTable instance.

A lot of problems example:

A good solution here will be to change the constraint �on delete� default to �set null�, yet, I didn�t find a way to make hibernate to do this for me. The only options as I can see that are
a) To manage the delete by my own .
b) To create my DB alone.

Any better solutions?

Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!