org.
hibernate
.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing:
This is mainly encountered in the cascade operation of ManyToOne, such as a new object is new, and it is saved into a new new object (that is, not persistent) before it is saved.
The solution is to check out the object before saving or updating (this is a persistent state).
The solution is to set the cascade of many-to-one to:
cascade="save-update,persist"