I receive following error when I save the object using Hibernate
object references an unsaved transient instance - save the transient instance before flushi
In my case using Cascade.ALL was adding unnecessary entry to the table, which already had same object (Generating a child value without an id does just that). So I would have to work around with getting child object from repository first, and setting it into the main object instead of the one causing the issue.
Student s = studentRepo.findByName(generatedObject.getStudent().getName())
generatedObject.student(s);