hibernate中的关系和注释问题

时间:2016-03-04 17:35:04

标签: java hibernate sqlite relation

我无法让它发挥作用,下面有我的情况,每次我都有例外:

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文件夹。

0 个答案:

没有答案