创建类我创建的类:休眠 - 从模式
@Table(name = "FILE_SET")
@Entity
public class FileSet
{
@Id
@Column(name = "FileSetId")
private final long fileSetId;
@Column(name = "FileSetState")
private final int fileSetState;
@OneToMany(targetEntity = Variables.class)
private final Set<Variables> variables;
}
和
@Entity
@Table(name = "VARIABLES")
public class Variables
{
@Id
@Column(name = "VariablesId")
private final int variablesId;
@ManyToOne(targetEntity = FileSet.class)
@JoinColumn(name = "CurrentFileSetId")
private final long currentFileSetId;
@Column(name = "CurrentDevicesDictId")
private final long currentDevicesDictId;
}
而这种代码是装箱表: https://zapodaj.net/b18d0afb396e5.png.html
,但我想只有 “变量”和“FileSet”,其中变量中的CurrentFileSetId是来自FileSet的外键。我究竟做错了什么?我第一次使用hibernate。
外键列名是'CurrentFileSetId'。 –
@ v.ladynev纠正! – eatSleepCode