Object references unsaved transient instance

the following error occurred when saving data using Spring DataJPA today:

Exception in thread "main"  org.hibernate.TransientObjectException: object references an unsaved transient instance  save the transient instance before flushing: com.edurt.core
May.10,2022

this is because your object references an unsaved transient instance, in other words: because the record of the master table has not been inserted, the slave record referring to that record cannot be inserted

cascade all persistence operations of Hibernate to associated entities through cascade=CascadeType.All .

Menu