IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST

Hello,
I am trying to insert data in two entities at the same time, but on certain occasions it gives the error of “IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST:” and I don’t really know how to fix it, I would greatly appreciate your help.

I got the same error and was able to fix it. Please post your code and I may be able to point out something for u

Can you tell me how to fix it?