You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
could not execute statement; SQL [n/a]; constraint ["FKDBFSIV21OCSBT63SD6FG0T3C8: PUBLIC.NOTES FOREIGN KEY(RECIPE_ID) REFERENCES PUBLIC.RECIPE(ID) (1)"; SQL statement: delete from recipe where id=? [23503-197]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
Expected behavior:
You can delete the recipe after an update.
The text was updated successfully, but these errors were encountered:
The issue is in entity modeling.
After updating the recipe the new row is created in the "notes" table. The new note has reference to the recipe_id.
On the other side, the "recipe" table stores reference only for the new Note.
Possible solution:
Add orphanRemoval to the relationship. This parameter will prevent creation of orphaned records and will fix initial issue.
Here's a code snippet for Recipe.java:
Steps to reproduce:
Expected behavior:
You can delete the recipe after an update.
The text was updated successfully, but these errors were encountered: