Viewed 21k times. Why hibernate set foreign key to NULL before delete? Improve this question. AnEi AnEi 1 1 gold badge 2 2 silver badges 8 8 bronze badges.
Add a comment. Active Oldest Votes. I had a similar problem which was fixed by using false for these values. Improve this answer. Community Bot 1 1 1 silver badge. Jesse Webb Jesse Webb I try set FK nullable, but is not good idea. Is there any other solutions? When you set insertable and updatable to false , you are telling Hibernate that you will handle saving modifications to ModelView records manually.
AnEi If you are still having these errors, can you share some of the code you are using to cause it? Hibernate issues then only deletes in right order, doesn't attempt to update FK to null. It is still possible to update your ModelView. If you are still confused, please ask a new question and you will get more help that way.
Are you setting the hibernate version to 2. To manually edit the hbm-files is not an option! Regards Niklas. Posted: Tue Jan 25, pm. All rights reserved. FAQ Search. Page 1 of 1. Previous topic Next topic. Post subject: Cascade delete with not null column Posted: Wed Jan 19, pm. Post subject: Posted: Wed Jan 19, pm. Hibernate Team. Read the documentation some more. Bulk Delete. Bulk Update. Bulk Merge. Accepted Answer I have to break your problem down to two parts First - let's talk about your database schema design.
Minjun Yu. Popular Answer In Hibernate, you need to decide who is owning the relationship. View more on Stack Overflow. Prime Library. Not affiliated with Stack Overflow.
0コメント