object references an unsaved transient instance - save the transient instance before flushing
使用SpringBoot+SpringData做一对多的映射操作报题目上的错误解决方案在OneToMany和ManyToOne的注解上都加上cascade=CascadeType.PERSIST@OneToMany(mappedBy="roles",cascade=CascadeType.PERSIST)@ManyToOne(cascade=CascadeType.PERSIST)再次运行就ok了