Hello,
I'm new to hibernate. I have an object which contains a ManyToOne relation with another entity. I want that object to be the foreign key.
For a better understanding of my problem:
Code:
*/
@Entity
@Table(name = "Employee")
public class Employee implements Serializable {
@Column(name = "name")
private String firstname;
@Column(name = "insertion")
private String insertion;
@Column(name = "lastname")
private String lastname;
@Column(name = "adres")
private String adres;
@Id
@ManyToOne
private User user;
The object user contains the primary key I want to use for the entity Employee. If I put the @Id annotation, it is wrong and I get an error.
Does anyone know a good solution? Thank you!