我无法让它发挥作用,下面有我的情况,每次我都有例外:
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: app.mail.MailFolder
public class MailFolder {
@OneToMany(targetEntity=MailFolder.class, cascade = {CascadeType.ALL}, fetch=FetchType.EAGER, mappedBy="parent")
@Fetch(value = FetchMode.SUBSELECT)
public List<MailFolder> folders;
@ManyToOne
public MailFolder parent;
问题在于注释,MailFolder类似于具有父级和子级的普通os文件夹。