• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

set null on delete of one to one relationship

 
Sharon Adar
Greenhorn
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:

http://opensource.atlassian.com/projects/hibernate/browse/HHH-2707\
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2007

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?

G�day!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic