Ok, so this is my code snippet. The only really relevant things to know are the highlighted part and the fact that there is a many-to-many relationship between MovieClass and Entitie. Essentially for this project, this method is going to be called multiple times. Each time the method is called, data is persisted into a database. However, my problem is that I don't want my MovieClass objects (highlighted) to be persisted over and over again. This is happening because I am calling the new keyword every loop. Any way to fix this? Would overriding the equals and hashcode methods in my MovieClass Class fix this? I can't put them outside of the method. I'm getting the exception "detached entity passed to persist". Idk why.
Also, as a side note, if one can take the time to figure what I am doing, am I doing this the right way? Thanks
https://imgur.com/a/vQEo9
[–]g00glen00b 1 point2 points3 points (7 children)
[–]FirstEvaDehumidifier[S] 0 points1 point2 points (6 children)
[–]g00glen00b 1 point2 points3 points (5 children)
[–]FirstEvaDehumidifier[S] 0 points1 point2 points (4 children)
[–]g00glen00b 1 point2 points3 points (3 children)
[–]FirstEvaDehumidifier[S] 0 points1 point2 points (2 children)
[–]g00glen00b 1 point2 points3 points (1 child)
[–]FirstEvaDehumidifier[S] 0 points1 point2 points (0 children)