This is not strictly SQL but Hibernate: I used the feature intellij has for generating the annotated hibernate classes for my database.
SQL for one table is this:
(
id int NOT NULL AUTO_INCREMENT,
tagname varchar(255) NOT NULL,
simulation_id int NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (simulation_id) REFERENCES simulation(id)
);```
but the generated classes look like this:
``` @GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@Column(name = "id", nullable = false)
private int id;
@Basic
@Column(name = "tagname", nullable = false, length = 255)
private String tagname;
@Basic
@Column(name = "simulation_id", nullable = false)
private int simulationId;
@ManyToOne
@JoinColumn(name = "simulation_id", referencedColumnName = "id", nullable = false)
private SimulationEntity simulationBySimulationId;
simulationBySimulationId is a column that doesnt exist on my table.Why was it created? Am i supposed to use it? Why was @ManyToOne not put on simulationId, which is the foreign key on my table?