I'm working on an app with Angular in the frontend, Spring in the backend, and SQL for database. One of the functions will be to post recipes with ingredients and steps to the database (currently my local machine). I have a recipe class, ingredient class, and step class; recipe and ingredient have a many-to-many relationship and so do recipe and step. I had a hard time figuring out how to get the join tables to post but I eventually did, BUT it only works properly SOMETIMES. Let's say I'm posting the same recipe multiple times with the same 5 ingredients and the same 3 steps. Sometimes all 5 ingredients and all 3 steps go through and it works how it should (I'd say about 20-30% of the time it all goes through the right way). Sometimes, only certain ingredients or certain steps go through. There is literally no pattern to which ids go through and which ones don't. I've included a screenshot of the 2 join tables after entering the same recipe 3 times. Also, I'm getting no errors in the console at any point.
Is there any high-level reason this might be happening? Or would my code be necessary to troubleshoot?
Screenshot of the tables:
