I have 3 tables: user, stuffperuser (pk: FKuser & FKstuff), stuff. When I don't use cascading, I get an error: "Cannot add or update a child row: a foreign key constraint fails"
The mapping files are correct. I need some sort of cascading. It works when I add cascading in the set property of the many-to-many relationship to add non-existent data to user & stuff, but its overwriting data in stuffperuser. Whenever I save an object which contains a 'stuff' which was already entered in stuffperuser, it overwrites the row, even when the other part of the PK is not thesame user. So basicly the previous user with that 'stuff' is overwritten by the new user with the same stuff.
It should always add a new row in the table stuffperuser if it is a new user, even with stuff that is already entered by another user.
That is not something that I want, but I can't seem to sort out where (stuff or user) to put the cascade rule and which one. The property inverse is set to FALSE.
I've looked up different sources, such as the offical hibernate website. I understand how cascading works with 2 tables, but with hibernating and 3 tables while the second is a normalization table, the dices role a bit different. Thanks for any input.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.