I created classes:
@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;
}
and
@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;
}
And this code is crating tables: https://zapodaj.net/b18d0afb396e5.png.html
But I wanted to have only "Variables" and "FileSet", where CurrentFileSetId in Variables is foreign key from FileSet. What am I doing wrong? I'm using hibernate first time.