• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate foreign key constraint

 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anybody know if hibernate supports foreign key constraints so that if I try to delete something that is being depended on the delete will fail?

example:
If I have a Person Object and that person has an Address Object, trying to delete the Address without deleting the Person would fail.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe there is no support for that kind of a thing -- just the other way around (i.e. if cascade is set to "all-delete-orphan" and you delete the parent, the children are deleted as well). Then again, I'm certainly not 100% about that so you better wait for a second opinion...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic