Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java hibernate中的关系和注释问题_Java_Hibernate_Sqlite_Relation - Fatal编程技术网

Java hibernate中的关系和注释问题

Java hibernate中的关系和注释问题,java,hibernate,sqlite,relation,Java,Hibernate,Sqlite,Relation,我无法让它工作,下面是我的案例,每次我都会遇到例外: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: app.mail.MailFolder 公共类邮件文件夹{ @OneToMany(targetEntity=MailFolder.class,cascade={Cascad

我无法让它工作,下面是我的案例,每次我都会遇到例外:

org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: app.mail.MailFolder

公共类邮件文件夹{
@OneToMany(targetEntity=MailFolder.class,cascade={CascadeType.ALL},fetch=FetchType.EAGER,mappedBy=“parent”)
@Fetch(值=FetchMode.SUBSELECT)
公用文件夹列表;
@许多酮
公用邮件文件夹父文件夹;

问题在于注释,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;